You're reading one of the top pains on Elastic (Elasticsearch / Kibana) — a free sample of the catalog. Create a free account to browse all Shopify & Atlassian pains and the basic Chrome catalog.
Data engineers find AI-generated SQL unreliable for complex queries
.78
Demand — how loud & how many (score)
Willing to payImplicit
Momentum (7d)▲ 239.2%
Cluster65 posts · 58 people
MarketplaceElastic (Elasticsearch / Kibana)
Updated19h ago
The story
The pain
We still write a lot of SQL by hand because AI tools produce code that looks correct but has subtle, hard-to-detect flaws. For simple queries it's fine, but for complex transformations, multi-table joins, or recursive logic, the AI often introduces performance problems, wrong syntax, or logical errors that are costly to catch in production.
Evidence
What people said · 65 complaints, 58 people
I'm still (re)writing a lot of SQL. AI has gotten good at writing valid SQL (passes the parser) but not performant SQL. I find that it's not great at keeping a coherent flow and re-joins things multiple times at different stages. For a single table (or two table) query it's usually pretty good. For complex queries it makes something that appears correct at first but often has small but significant flaws that are hard to detect.
Yes. But only because the SQL I write is generally too complex or has too much meta in the data for ai to do a good job. Typically this is mining deep lineage data from snowflake meta, which is dense and complex. AI kind of sucks at recursive SQL and dealing with nested data in the account_usage table.
I work in a project that is 100% BigQuery SQL. About 1 out of 20 PRs the sql breaks because the AI put syntax that isn’t correct for bigquery sql. We having testing to catch this, but yeah, the AI often gets mixed up
Export the pain — problem, evidence and market signals — as Markdown, PDF or JSON. The Markdown export ships with a built-in briefing you can hand straight to a developer or an AI agent.