AI made the server cook the entire holiday dinner again every time one person rang the doorbell. Then it helpfully made two dinners.

Cardinal Rules. A Saturday cartoon about AI and databases.
Working out how to run a query is real work. The database looks at your tables, your indexes and its statistics, and decides on an approach. That decision can cost more than running the query.
So it keeps the decision and reuses it, the way you keep the leftovers instead of roasting a second turkey on Friday. Reheating is the right instinct almost all of the time.
The trouble starts when one recipe gets served to everybody. The plan was worked out for a customer with four orders, and now it is being used for the customer with four hundred thousand. The approach that was perfect for a small plate falls apart at that size. Same query, same plan, wildly different night. This is parameter sniffing, and it is behind a surprising number of it was fine yesterday reports.
Cardinal reads about this problem and reaches straight for the big hammer, which is to tell the database to recompute the plan every single time. That is cooking the whole dinner again for every doorbell. Now nothing is cached, the processor climbs, and the fix has quietly become the problem.
The grown up version is narrower. Recompile the one procedure that actually suffers, not the server. Or give the odd customer its own path. The goal is not to stop reusing plans, it is to stop serving one plate to a household of very different appetites.
Cardinal Rule
Reheat the plan. Do not cook Thanksgiving twice.
Recompile the one procedure that hurts, never the whole server.
Cardinal ate the leftovers and denies everything. 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, every light on the dashboard is green and nobody can log in.
The problem is not the leftovers, it is serving one plate to everybody.
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.




