How to Recognize the Antipattern
The following are symptoms of the Index Shotgun antipattern:
-
“Here’s my query; how can I make it faster?”
This is probably the single most common SQL question, but it’s missing details about table description, indexes, data volume, and measurements of performance and optimization. Without this context, any answer is just guesswork.
-
“I defined an index on every field; why isn’t it faster?”
This is the classic Index Shotgun antisolution. You’ve tried every possible index—but you’re shooting in the dark.
-
“I read that indexes make the database slow, so I don’t use them.”
Like many developers, you’re looking for a one-size-fits-all strategy for performance improvement. No such blanket rule exists.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access