carnival ride with loops and circles
PHOTO: Pixabay

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 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 10 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 1 times the power, why do we need something with 10 times the power, where the majority is wasted?