Lets say we have a blog site:

When an admin creates a new blog post, it will be added to the database.
When a user loads the website, PHP will check the database for all posts.

When an admin creates a new blog post, a new static page will be generated/old one updated.
When a user loads the website, they will receive a static html page.

Now obviously with method #2 the user should have a faster loading time because no backend scripts are being executed. But is it worth doing? Would there be a significant difference (like half a second) or is the time this will save negligible?


1 Answer 1


For a typical site on a server which is not under heavy use the difference should be negligible - certainly nowhere near 500ms. That said, generalization is difficult and very site/application dependant.

Most of the overhead is not the reading/writing to/from the database, but the additional overheads of parsing the code through php - especially when the database contents are manipulated/parsed - eg adding a header and footer, searching the returned page for placeholders (eg shortcodes in WordPress), complex designs which require multiple database queries, access perms etc.

That said, computers are unbelievably fast at these kinds of operations, and a filesystem is just a kind of non-sql database - in fact I'd go for an optimized database based solution on SSD over an optimized static html solution on hdd on a system which is memory constrained.

Its worth noting that - on a lightweight database/static page setup overheads relating to Internet traffic - eg DNS lookup, https negotiation will be a far bigger component of how long it takes to load a page then actually getting the page.

Its also worth commenting that many caching modules/plugins are a hybrid system which renders the static page to disk and whenever its changed in the database recreates a static page which is given to users on request.

  • Great answer. I've debated this in my mind many times. I would emphasize that "optimized" DB" is key along with properly optimized SQL statements.
    – Trebor
    Jan 16, 2021 at 0:24

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