Static or database? Our love of complexity

A database-driven website is a bit like having a seven-seater car. If there’s only two in your household do you really need it? Perhaps a simpler, more energy-efficient static website is better? I used to make these sorts of arguments a lot about 15 years ago, and then for whatever reason I stopped making them and I started using databases for our websites because everyone else was doing it and it was more convenient.

Most websites today are database driven. This means that the content, code and other components are stored in a database. The pages on the site don’t actually exist permanently. Rather, when you click on a link for a page or type the URL in, the page is dynamically created, going into the database to fetch all the relevant content, code and components. A database website is very effective where things are likely to be constantly changing – for example, stock levels or prices for a particular product.

The alternative to a database website is what is called a ‘static website’. This is a website whose pages permanently exist as HTML. A great many websites do not need to be dynamically created. They can work perfectly well as static sites. The benefits of this approach are that a static site tends to be more reliable and has a lesser environmental impact because there’s less processing and transfer of data, as well as the fact that a static page can load much faster.

In 2018, I decided to compare benefits for a static versus database website. When we tested, it typically took a static page 2.9 seconds to download on a smartphone. However, using a database-driven approach it took 5 seconds. That’s a big difference, but our site was already very simple and lean. I have seen analysis that indicates that a static website can be up to ten times faster than an equivalent database-driven one. Also, with the static website there was 378 KB of data being transferred, while with the database-driven website there was 701 KB. Ours is a tiny website with very slim and lean design. Imagine all the energy and time that could be saved if the millions of websites that don’t need to be database driven migrated to static.

So, if static websites are better in many situations, why aren’t they used more? Why has the migration been in the opposite direction? Because of progress. Because a database is more ‘advanced’ than a static website, so a database must by definition be better, mustn’t it? We become willing zombies in the march of progress, assuming that innovation and what is new are by definition progress. We are so enamored by more power and more processing and more complexity that we believe that more always delivers better. We must become much more questioning of innovation and new things. How much is needed to do the job? If we can do the job with 1X power, why do we need something with 10X, where 9X is wasted?

7 thoughts on “Static or database? Our love of complexity

  1. Jim Reed

    I think the biggest driver of dynamic site adoption is that modern content management system make it much easier for staff people to create and maintain pages. Since many organizations are unwilling to hire enough skilled people to build and maintain their site and insist that every subject matter expert be able to do it themselves, a modern CMS is the only solution if the organization is to have any chance at consistency in the design, navigation, etc. of the website. Of course, letting anybody with the right user account tinker with the website creates a host of other issues around content quality, but most managers seem unconcerned about that.

    Reply
    1. Gerry McGovern Post author

      Good points. Yes, who cares about the quantity when you can get lots of cheap quantity.This attitude hasn’t changed much in 20 years.

      Reply
  2. Ben

    Great article Gerry, I’ve built many sites that should have been static but the client has said “I want WordPress” for no other reason than their competitors use it or their current site is built in it ands “That’s what we know”. They’ll update their site maybe once a year.
    I’ve recently been building static sites but with a headless or decoupled CMS – I know this is much better for performance but do you know if using a headless CMS has less environmental impact?

    Reply
    1. Gerry McGovern Post author

      Thanks, Ben. My developer Daniel told me that “What matters is the time in which the page is loaded and the size of the page/website itself.” So the smaller you can make the page and the faster you can get it to load, the better it is for the environment.

      Reply
  3. janw

    I recently saw a talk about a 80year old biology professor, who as part of his life’s work had a static website (all manual html’s) with 1000’s of pages. And a butt load of of taxonomies/categorization indexes.

    The content rarely changes but, so static wasn’t bad. But from a maintainers perspective it was nearly impossible to add anything.
    So after a big migration project it’s now in a WordPress where the indexes are generated, and now also is searchable.

    I don’t think there is anything wrong with database driven sites, but you should generate static cached files from static content. If possible only flushing it when something is edited. Most CMS’es have ways to do this.
    But getting it right can be hard, and most don’t bother.

    Reply
    1. Gerry McGovern Post author

      Good points. Yes, by caching the site you can get the best of both world’s.

      A great many sites are small and really don’t change at all, so they don’t need a database, but if you’ve got a complicated site that’s constantly evolving, yes, a database makes a lot of sense.

      Reply
  4. Brian

    As you allude to in your final paragraph, it’s often feature fetish and upsell. Even the content delegation argument falls apart when the redevelopment costs could have paid for years of updates. But it’s so embarrassing to be using HTML when the cool kids have moved on. While there is a place for database-driven sites, in many cases it’s hard to see how their complete dominance is of benefit to clients or users rather than developers or ICT companies.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *