Slow SQL Often Calls for Better Assumptions, Not Just More Indexes

A development team asked for a review of the SQL behind a change-data publishing job before moving it from daily to hourly runs. In QA, a full run took 10 to 12 minutes, and after the review it dropped to under 30 seconds, with most production queries now finishing in under a millisecond. The gains came mainly from questioning the queries and checking assumptions against real data rather than adding indexes. The author highlights functions applied to indexed columns and unverified assumptions about nulls as common silent performance killers. The article also warns that AI-drafted SQL often adds defensive functions like COALESCE or TRIM that are harmless on small test tables but can force full scans on large production tables.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in