AI ran the query in two seconds and every number came back wrong. It ran beautifully, which is not the same thing at all.

Cardinal Rules. A Saturday cartoon about AI and databases.
It ran is the weakest test we have, and it is the one almost everybody uses.
The classic way a fast query lies is a join that quietly duplicates rows. One customer has two addresses on file, the join fans out, and now that customer appears twice in the revenue total. Nothing errors. Nothing warns. Revenue is simply eleven percent too high, which is close enough to look plausible and far enough to matter.
The other classic is a LEFT JOIN turned into an INNER JOIN by a WHERE clause on the right hand table. Customers with no orders vanish from a report about customers. The report does not mention that anybody is missing. Reports never do.
Cardinal writes both of these constantly, because both are perfectly ordinary SQL. Nothing about the text is wrong. The model has no way to know that your address table has two rows per customer, since it has never seen the data and, as we established in week one, has never seen your schema either.
So use the only test that works. Pick one customer you know by heart, and check that customer by hand. Then check the row count against something you already trust, last month’s report, the finance number, anything with a history. Two minutes, and the board meeting stops being a gamble.
Cardinal Rule
It ran is not the same as it is right.
Check one row you know by heart, then check the total against something older.
Cardinal insists the query was structurally magnificent. On the desk this season: AI: Nobody’s in There. But we’re still in here. (on Amazon) and 100 AI Interview Questions and Answers for Data Professionals (Kindle, also on Amazon.in, paperback and audiobook).
Next Saturday, Cardinal tests something on ten rows and calls it instant.
Finishing fast is not a result, it is a starting gun.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.
Discover more from SQL Authority with Pinal Dave
Subscribe to get the latest posts sent to your email.



