AI Tested It on Ten Rows and Called It Fast

AI
No Comments

AI tested it on ten rows, timed it, and called it lightning. Production has forty million rows and a different opinion.

Three panel cartoon. The red bird says it tested the query and it was instant. Sam asks on how many rows and the bird says ten. The production counter reads forty million and the bird says ten rows agree with everybody.

Cardinal Rules. A Saturday cartoon about AI and databases.

Small data is the most agreeable thing in computing. Ten rows will validate any query you put in front of them, including the terrible ones.

The reason is not mysterious. With ten rows the database can read the entire table faster than it can think about being clever, so every plan looks the same and every plan is fast. Reading the whole table ten times is still ten times nothing.

At forty million rows the arithmetic turns. That same query now reads the whole table for every row it is matching against, and the work does not grow gently, it multiplies. This is the moment people describe as the query suddenly broke. Nothing broke. The query was always shaped like that, and the small table was being polite about it.

Cardinal has no sense of scale at all, which is easy to forget because Cardinal writes like somebody who does. A model cannot feel a table. It does not know your orders table is forty million rows and your country table is fourteen, so it cannot tell you which join is about to become the whole afternoon.

The fix is to stop testing on toys. Test against production sized data, or at the very least against a copy that carries production statistics, and look at the actual plan rather than the stopwatch. And if somebody tells you a query is fast, the only useful follow up is the same four words Sam used. On how many rows.

Cardinal Rule

Small data says yes to everything.

On how many rows. Ask it every single time.

Cardinal has asked for a bigger test table and a nap. 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, the server cooks Thanksgiving dinner twice.

A fast test is not proof, it is a rehearsal in an empty theater.

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.

AI, Execution Plan, SQL Performance, Testing
Previous Post
Technical Debt at AI Speed: Nobody Set a Credit Limit

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.