Cost Surface Distortion in Database Engines Under AI-Based Query Rewriting
Keywords:
cost-based optimization, query rewriting, cloud databases, execution drift, database performance.Abstract
Cost-based query optimizers are essential for performance tuning in cloud database engines, but AI-based query rewriting can affect their stability. Although rewriting expands optimization choices and may improve execution plans, it can also distort cost surfaces, causing unstable plan selection and unpredictable performance. Existing studies mainly focus on performance gains and give limited attention to cost model consistency. This study analyzes cost surface distortion caused by AI-driven query rewriting by modeling cost landscapes, formalizing rewrite transformations, and applying metrics such as plan optimality deviation, cost gradient variance, and execution drift. Experimental evaluation across different workloads and cloud database engines shows that rewriting can improve or reduce performance depending on the level of cost surface deformation. Complex queries show higher optimizer uncertainty and execution instability. The study highlights the need for adaptive rewriting mechanisms aligned with cost estimation models to improve optimization reliability in modern database systems.