At work, we had an operation that was taking too damn long. Looked at the code, looked at the query it was generating, and it was pretty horrible, but I don’t see any way to avoid doing it. Then used the SQL “explain” on the query. Hmmm, it’s doing a sequential scan on two different tables. Hmm… Put an index on one column on one of the tables. Suddenly it’s only doing a lookup on one table. Ran downstairs to the big 30-plex test machine. Did the test once. Took 1:31. Added the index. Ran the test again. Took 0:08.
I’m a fucking genius.