The 60-Second Query That Changed a Business

·1 min read·

A loan summary query took 60 seconds for two years. After a schema redesign and two indexes, it ran in 4 seconds.

The query had been taking 60 seconds for two years. Everyone had accepted it.

When I joined AfriCred: missing composite indexes, unnecessary full-table scans, three subqueries collapsible into two joins, and a schema decision from year one forcing a cross-table recalculation on every page load.

The rewritten query ran in 4 seconds. The reaction from the team was disbelief.

56 saved seconds per query. Hundreds per day. Compounded across two years of staff time. The slow query had not been a technical problem. It had been a business tax.

Optimise the slow queries. The ROI is almost always immediate.

— Dick Bassey | DevDick | 2022

Share this article
← Back to all writing