I don't understand why wordpress stores that kind of data: posts' content and pages' content, directly within the database instead of storing it in the filesystem and referencing them in the database with an URL/path. Could someone please explain it to me?


As far as I know storing raw images in within the database is a bad practice since it increments considerably the size of the DB unneededly, and that's fine because images aren't stored within the database (i think), so my question is about "Why text isn't treated the same way?" and "If you have a large amount of huge posts wouldn't it somehow encounter the limits of the database sooner or later?"

closed as primarily opinion-based by Howdy_McGee, TheDeadMedic, Mayeenul Islam, Pieter Goosen, Nicolai Nov 25 '15 at 9:51

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I think if you're going to put things like post_meta ( Custom Fields ) and Featured Image URLs in the database then might as well also store your other content there too so it's all in one place. If you were to store everything in the file system it would be much more difficult to navigate and query. – Howdy_McGee Nov 20 '15 at 20:20
  • but when you store a featured image you just store the reference to where the image is, you don't store the whole image in within the database. – Rubén Marrero Nov 20 '15 at 21:03
  • You could store the image in the database technically as a blob but you wouldn't want to. I imagine by storing content in the file system you would have to store just the raw content separately and pull it into your theme ( because having 1000 static pages in your theme is insane ) so you would need to ensure that this directory doesn't get index which is just another thing to worry about. You don't need to worry about that via the database. Performance ( reading and writing ) it'll probably be the same but databases are cleaner and more scalable. – Howdy_McGee Nov 20 '15 at 21:12

WordPress was forked (2003) from b2 that used PHP/MySQL, to generate pages dynamically - So I think that's the why part.


  • Then I assume it would make more sense to treat posts and pages content with files and referencing them with an URL/path (as it is done with images) , right? – Rubén Marrero Nov 22 '15 at 7:48
  • ... maybe things are changing with Calypso? An interesting blog post regarding Calypso: What would we build if we were starting from scratch today, knowing all we’ve learned over the past 13 years of building WordPress Maybe this will become the future of WordPress ? @ – birgire Nov 23 '15 at 22:15

The only answer is "because". Not every software design decision is a result of 10 years of research and some time you just go with what you know better or what you think will be easier to work with.

In the end DB is files so the whole discussion here is mainly about semantics.

  • The discussion isn't about semantic but about negative impact in the performance of the DB. – Rubén Marrero Nov 20 '15 at 21:06
  • what negative impact? If you have a specific point please edit the question to focus it. – Mark Kaplun Nov 20 '15 at 21:09
  • By negative impact i mean either encounter the DB's size limits or affecting negatively to its performance. – Rubén Marrero Nov 20 '15 at 21:15
  • 3
    I don't mean any disrespect, but to me it sounds like you don't understand the amount of effort invested over the years in the development of performant and stable DBs.The main feature you seem to miss is indexing and search that they are just impossible to do under your scheme. So it doesn't really matter if you have some more restrictions (very unlikely that you have at all) or have some performance penalty as there is no chance anyone would have been able to code half to the features by himself or in a small team. – Mark Kaplun Nov 20 '15 at 21:25
  • 2
    @ To keep a large content of files need to be inside a archiver o cabinet (PC if digital archive), to search easily is needed to create a list with box or drawer location and some tags to identify them. to handle this kind of method is needed some special data handler. That list with some columns where called Database, however to get a faster information all data from files were stored on other DB creating relationships to get the correct data, so we have several DB for the required information. If this make no sense you should work with data manually – Fernando Baltazar Nov 21 '15 at 0:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.