SQLens: Continuous Code-to-SQL Visibility in the Wild

Xiao Yang, Mo Sha, Yiran Li et al. · Proceedings - ACM-SIGMOD International Conference on Management of Data · 2026

Modern Internet-scale services evolve, yet database interactions are increasingly obscured by languages, frameworks, and abstraction layers. This loss of visibility weakens the link between code changes and SQL behavior, leading to performance regressions, security risks, and costly diagnosis. SQLens is a practical system that restores auditable, end-to-end visibility between application code and executed SQL in large, heterogeneous codebases. It combines static program analysis with LLM-guided reasoning in a closed-loop workflow: starting from database emission sites, cooperative agents traverse control and data flows to reconstruct SQL construction and parameter binding. The system refines these mappings using SQL logs collected over time and stores them in a versioned knowledge layer supporting code-to-SQL lookup and SQL-to-code attribution. Deployed at Alibaba Group and evaluated on diverse open-source services, SQLens achieves high precision and recall in code-to-SQL reconstruction, reduces SQL-incident resolution time, and, when integrated with continuous integration pipelines and runtime observability, supports detection and mitigation of SQL issues, enabling continuous SQL governance at industrial scale.

Cited by 0 works. doi:10.1145/3788853.3803091

Authors

References