How AI Boosts SQL Accuracy and Performance: Real‑World Demo & AutoMV Insights

The April 16 online meetup by Tencent Game Data and StarRocks explored AI‑generated SQL, tackled NL2SQL challenges, showcased a demo that lifted one‑shot accuracy to 89%, and introduced StarRocks AutoMV technology that automates materialized‑view recommendation and merging to accelerate data‑warehouse queries.

StarRocks
StarRocks
StarRocks
How AI Boosts SQL Accuracy and Performance: Real‑World Demo & AutoMV Insights

Improving NL2SQL Accuracy

Large language models (LLMs) have lowered the entry barrier for natural‑language‑to‑SQL (NL2SQL), but several technical obstacles still limit one‑shot correctness:

Metric‑requirement descriptions are often ambiguous because natural language is unstructured.

Input information may be incomplete: table schemas, column meanings, or data dimensions are not always provided.

LLMs generate inaccurate SQL due to limited generalisation ability or insufficient pre‑training data for the target domain.

LLMs lack explicit knowledge of the target database dialect and syntax.

Practical mitigation measures:

During the requirement‑gathering phase, enforce a structured template for metric descriptions and reuse existing metric definitions to disambiguate terminology.

Apply schema‑linking and join‑candidate inference. Store inferred schema links in a knowledge base or graph so the model can select correct tables/joins.

Fine‑tune the LLM on a domain‑specific NL2SQL dataset. Lightweight methods such as QLoRA or reward‑modeling can be used to improve generation quality without full‑scale training.

Post‑process the generated SQL: rewrite syntax to match the target dialect, inject function hints in the prompt, and iteratively re‑run the query to correct execution errors.

After a year of iteration, Tencent Game achieved a one‑shot NL2SQL correctness of 89 % , substantially increasing data‑work efficiency.

StarRocks AutoMV Technology

AutoMV is an automated materialized‑view (MV) solution that analyses query history to recommend, create, and merge MV schemas, reducing manual MV design effort and improving cost‑benefit ratios.

Automatically extracts SPJG (Select‑Project‑Join‑Group) patterns from complex SQL and generates candidate MV definitions.

Uses rule‑based and cost‑based algorithms to merge or prune MVs, ranking them by estimated benefit.

Supports single‑table and multi‑table sources, including local tables, Iceberg, and Hive tables.

Operates at maturity levels L2–L5; production currently runs at L2, which provides the above capabilities without requiring expert MV designers.

AutoMV has been deployed for transparent query acceleration, metric platforms, and GenAI integration, making MV acceleration a routine optimisation layer.

AI‑Powered Lakehouse Practice at Tencent Game

Tencent Game processes >30 000 data‑extraction requests per year, where manual SQL authoring is a major bottleneck. By combining a large‑scale LLM with StarRocks’ lake‑warehouse architecture, they built an AI‑driven data‑asset system that:

Organises data assets in layered catalogs (raw, curated, analytics).

Integrates proprietary domain models, a general LLM, and an agent‑based collaborative framework to interpret user intents.

Allows users to query assets directly via natural language, automatically generating and executing optimized SQL.

Key performance outcomes:

Self‑service delivery rate increased to 70 % .

Asset reuse rose from 70 % to 77 %.

One‑shot NL2SQL accuracy stabilised at 89 % .

These results demonstrate that AI‑augmented NL2SQL, together with automated materialized‑view management, can dramatically reduce governance cost and accelerate data‑driven decision making.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AImaterialized viewSQL GenerationNL2SQLAutoMV
StarRocks
Written by

StarRocks

StarRocks is an open‑source project under the Linux Foundation, focused on building a high‑performance, scalable analytical database that enables enterprises to create an efficient, unified lake‑house paradigm. It is widely used across many industries worldwide, helping numerous companies enhance their data analytics capabilities.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.