“SQL-Tuning is black magic like alchemy: it consists of obscure rules, understood only by a handful of insiders.”

That is a myth. SQL databases use well-known algorithms to deliver predictable performance. It is, however, easy to write SQL queries that cannot use the most efficient algorithm and thus deliver unexpected performance.

The following questions provide examples that might make you believe that SQL tuning is black magic. The explanations at the end are just a few sentences long and reveal that the black magic is pure science.

Choose a database

DB2 LUWMySQLOraclePostgreSQLSQL ServerSQLite

60% Fail?

I checked 28,000 results: only 40% answered more than three of the five questions correctly.

“You consider three correct answers to five questions as failed?”

Yes, because most questions have only two options. That gives you a 12.5% chance to pass the quiz by guessing. Accepting three correct answers would give you a chance of 29% to pass by guessing. That would be unreasonable, I think.

More about the results in this blog post. But remember to take the quiz first.