I wrote a whole article about it, and oh wow, it still exists. It was probably the first optimization I ever did in my life, and it was while I was learning SQL.

And writing an edu-tainment article aimed at total laymen as well as beginners was also fun.


Sadly, czech language only. But... the english autotranslation actually looks readable:

Long story short, though: 4 or 5-table join going from 7 seconds before optimization, to 0.08 seconds after optimization. Both were written by me, the optimized one was written without any reading on how to optimize SQL, based purely on me actually stopping to think about how I can reduce the DB load based on the little that I knew about how SQL servers work.

Optimization made it about 99,9999422% more efficient, based on my improvised efficiency metric of how many rows the query retrieves and produces versus how many are thrown away on the end due to the WHERE part of the query.

And that was also the day when my question of "what is there even to optimize in SQL?) was answered... by myself.

  • 0
    ...ehh, okay, the autotranslation is actually pretty crap =D
  • 1
    @Midnigh-shcode There exists some difference between "readable" and "high quality."
  • 1
    @powerfulparadox yeah. but i tend to toy with language, and it's precisely the elegant and witty formulations which autotranslate breaks into nonsense which is only understandable thanks to the context, so each time it happened it was a hard hit for me =D
Add Comment