Archos Labs
Data as a Decision Infrastructure

Query Optimisation: The Environmental Cost Nobody Talks About

Rob Angeles3 min readPublished
Share
Query Optimisation: The Environmental Cost Nobody Talks About

Query optimisation reduces environmental impact of data processing. Learn why inefficient database queries are secretly destroying the planet and how to fix them.

That innocent-looking SQL query you just ran? It just burned enough energy to power a lightbulb for an hour.

Nobody thinks about this. We optimise queries for speed, not sustainability. But every inefficient join, every missing index, every SELECT * burns real electricity in real data centres powered by real fossil fuels.

The carbon footprint of bad code is invisible. Which makes it easy to ignore.

The Hidden Energy Crisis in Your Database

Here's what happens when you write inefficient queries: servers work harder. CPUs spike. Memory thrashes. Cooling systems kick into overdrive.

A poorly optimised query that runs in 10 seconds instead of 0.1 seconds uses 100 times more energy. Multiply that by millions of executions. The numbers get scary fast.

One financial services company I worked with discovered their reporting queries were burning $10,000 worth of electricity monthly. Not computing costs. Just electricity. The environmental impact? Equivalent to driving thousands of miles.

All from bad SQL.

Why Nobody Measures What Matters

We measure query performance in milliseconds. We should measure it in kilowatts.

But energy consumption happens somewhere else. In data centres we never see. On electricity bills we don't pay. The cost is externalised, so we pretend it doesn't exist.

Tech companies track user engagement obsessively. They A/B test button colours. But they don't measure the carbon footprint of their database queries. What we don't measure, we don't manage.

The Compound Effect of Lazy Programming

SELECT * FROM users seems harmless. You only need three columns, but grabbing all 50 is easier. Who cares about a few extra bytes?

The planet cares. Those extra bytes get transmitted, processed, cached, transmitted again. Each step burns energy. Multiply by billions of queries across millions of applications.

Lazy programming at scale is an environmental disaster. But it's a disaster nobody sees because it's distributed across thousands of data centres.

The Real Cost of Cloud Computing

"The cloud" sounds clean. Fluffy. Weightless. It's not.

Cloud computing runs on very real servers in very real buildings consuming very real electricity. When you optimise queries, you're not just saving abstract "resources." You're reducing actual carbon emissions.

Amazon knows this. That's why they publish sustainability metrics. Google knows this. That's why they invest in renewable energy. But most developers? Still writing queries like electricity is free and infinite.

Simple Changes, Massive Impact

The beautiful part: query optimisation isn't hard. Index your tables. Avoid N+1 queries. Use projections instead of SELECT *. Basic stuff that every developer knows but doesn't do.

One e-commerce site reduced their carbon footprint by 40% just by optimising their data stores. Same functionality. Same user experience. 40% less environmental damage.

The changes that help the planet also help your application. Faster queries mean happier users and lower hosting bills. It's the rare win-win-win.

The Future Depends on Efficient Code

Climate change is a collective action problem. But it's also a trillion individual decisions. Every query you write is a decision. Every index you skip is a choice.

We can't code our way out of climate change. But we can stop making it worse with wasteful queries.

Next time you write a query, ask yourself: would I run this if I had to hand-crank the generator powering the server?

Because metaphorically, we all are.

Share
Rob Angeles

Written by

Rob Angeles

Most consulting engagements split the thinking from the doing. Rob doesn't. Principal Consultant at Archos Labs, he owns the full stack — assessment, architecture, delivery — across retail, financial services, healthcare, and government.