How to Recognize the Antipattern
If you hear the following statements from members of your project, it could indicate a case of the Spaghetti Query antipattern:
-
“Why are my sums and counts impossibly large?”
An unintended Cartesian product has multiplied two joined data sets.
-
“I’ve been working on this monster SQL query all day!”
SQL isn’t this difficult—really. If you’ve been struggling with a single query for too long, you should reconsider your approach.
-
“We can’t add anything to our database report, because it will take too long to figure out how to recode the SQL query.”
The person who coded the query will be responsible for maintaining it forever, even if they have moved on to other projects. That person could be you, so don’t ...
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