AI-Assisted Database Work — The Machine Reads, The Human Decides

2026-08-07 · page · source ↗ · source summary

Pinal Dave's field report from nine consulting engagements where AI was deployed not to write SQL, but to read, classify, and extract from existing database artifacts at volume — with human verification as the structural keystone. The thesis: these aren't hard problems; they're tedious ones. The machine makes starting cheap; the human makes the output trustworthy. Invert that order and "the project produces a beautiful document full of confident fiction."


Key Quotes

"The most satisfying work of my career has not been tuning a query. It has been walking into a room where a team is quietly terrified of their own database, and walking out three days later with them arguing confidently about it."

The emotional core that Dave returns to throughout: the real output isn't a document or a test suite — it's a team that stops being frightened of the old system. "Being able to argue about your own database is an underrated form of wealth." This is a profoundly non-technical metric for technical work, and it's more honest than most.

"Feeding whole packages produced vague summaries. We got useful output only after splitting by procedure and passing the referenced table DDL alongside the code."

The most actionable technical detail in the piece. Context about the data — that P_CUST.TIER_CD is a three-character code with a check constraint, not free text — changed reasoning quality more than any prompt wording. This is a concrete instance of Agent Memory and Context's thesis that context engineering, not prompt engineering, is the real lever.

"Requiring the reason changed everything. A match justified by 'both are named CUST_STATUS' is a weak match and now it looks weak on the page."

The M&A schema mapping insight applies far beyond databases. Forcing the AI to articulate why it made a match turned a confidence score (always high, always useless) into a triageable artifact. The reason column is what let humans process 900 columns in a week and catch that one company's Active was the other's Archived. This is the same pattern as AI Code Migration with Claude Code's "make review adversarial and verification mechanical" — structure the output so that failures are visible, not buried in a number.

"It knew the mechanism. It did not know the blast radius."

Dave's one-line summary of the entire technology, from the query plan regression case. The AI correctly identified that a cardinality estimator change caused join-order shifts, and correctly listed the options. It then recommended a database-wide legacy setting that would have fixed six queries and pessimized several hundred others. This is the central tension of AI-assisted work: the model understands what but not how much.

"Not one of them is a hard problem. Every single one is a large, tedious, low judgment reading task that a competent person could do perfectly, given three months and no interruptions, which is a resource that has never existed."

The unifying thesis. These projects weren't blocked on skill — they were blocked on tedium. Reading 800 packages, 240 job definitions, 900 column pairs, 300 pages of compliance prose. The work was always possible; it was just never worth starting. What changed is that starting got cheap.

"This is not a story about AI understanding your database, it is a story about AI reading it fast enough that you finally can."

The closing sentence, and the best summary of what distinguishes Dave's approach from the "AI will replace DBAs" narrative. The machine doesn't understand — it reads. Understanding remains the human's job.

Key Themes

Critical Analysis

Dave's piece is the most useful kind of AI field report: specific enough to steal from, honest enough to trust. Every case names the failure mode alongside the success. It will state intent it cannot know (case 1). It will commit to one meaning of an ambiguous abbreviation with total confidence (case 3). It knows the mechanism but not the blast radius (case 8). It will happily propose queries for untestable requirements (case 5). This is not the usual "AI is amazing" blog post — it's an engineer documenting what worked, what broke, and what guardrails made the difference.

The article is a direct counterpoint to Text-to-SQL in the Real World, but not a contradiction. Stonebraker and Chen showed that LLMs fail catastrophically at generating queries for real enterprise schemas. Dave shows they succeed at reading them — not because they understand the schema, but because reading at volume is what language models do. The two pieces together draw a boundary: AI for database generation is not ready; AI for database reading and classification is here. The distinction matters enormously for anyone deciding where to invest. DeepSQL complicates the boundary slightly: it ships both capabilities in one product — fenced generation (EXPLAIN-validated, schema-whitelisted, read-only) alongside reading at volume — but still keeps a human as the only path to mutation.

Compare with AI Code Migration with Claude Code. Both are about using AI on large-scale codebase work, but the architectures are different. Anthropic's approach is a rulebook-driven factory: fix the loop, regenerate, throw away the first output. Dave's approach is a reading-and-triage engine: AI proposes, human decides, nothing is thrown away because nothing was generated — it was extracted. The two approaches aren't competitors; they solve different problems. Rulebook-driven generation works when the target is known (Rust, TypeScript). Reading-and-triage works when the target is understanding (what does this code mean, what is this column, what does this job do).

The "blast radius" problem is the deepest insight and the least developed. Dave's example from case 8 — the AI recommended a database-wide legacy cardinality setting — is a specific instance of a general failure mode: AI can diagnose a local problem correctly and propose a local fix, but it cannot assess the systemic impact of applying that fix globally. This is the same problem that makes Constraint Decay's findings so damning: every additional constraint (database, architecture, ORM) compounds the failure rate. The solution Dave arrives at — Query Store plan forcing for specific queries — is an instance of the general principle: contain the fix to the smallest possible scope. But he doesn't generalize the principle, and this is the article's one missed opportunity.

What's quietly radical: the consulting model. "None of these clients bought a product. There was no platform, no license, no vendor with a booth at the conference." The deliverable was a workflow, a verification step they weren't allowed to skip, and a written note about failure modes. Their own people run it all now. "I am not needed for any of it, which is exactly how a consulting engagement is supposed to end and almost never does." This is an honest description of what good AI consulting looks like: transfer the capability, document the failure modes, leave. The opposite of the vendor playbook.

The article's limitation is that these are all one-off projects built by a deeply experienced SQL Server consultant. Dave's 20+ years of SQL Server expertise is the hidden ingredient — he knows which system views to query, which Extended Events to capture, which DDL to feed alongside the code. Replicating any of these nine patterns requires someone who knows both the domain and the tool. The AI reduces the tedium; it doesn't replace the expertise. This is consistent with Laura Tacho — Data vs Hype's finding that AI is an accelerator, not a fixer — it makes good teams better and dysfunctional teams worse.


Connections


Sources: raw/nine-unusual-ways-my-clients-use-ai-with-sql-server, Nine Unusual Ways My Clients Use AI with SQL Server Last updated: 2026-08-07