Databases

SQL gotchas

Published · 2min

I’ve been reviewing some SQL queries recently, and I’ve noticed some things that people do that lead to far from optimal performance. Here’s a few, and what people should be doing.

COUNT(*) vs. COUNT(col)

At first blush, these may seem the same, but they actually mean …

Databases

SQL Tricks: SUM(), then COALESCE()

Published · 2min

Seeing as I’m after doing this for the umpteenth time just now, I thought I’d note it here. There’s no chance of me forgetting it, but somebody who doesn’t know the trick might find it useful.

I have to write quite a few reports where I …

Databases

Slow entry submission

Published · 2min

I’m getting a little pissed off with the query used to generate this front page. The last two times I’ve posted up new entries, the blasted thing’s gone and timed out on me for no good reason.

I wasn’t able to run the MySQL profiler on …