Replacing MySQL Correlated Scalar Subqueries with Window Functions on InnoDB
A correlated scalar subquery can turn a single-table read into repeated scans. This guide shows how to rewrite it as a window function in MySQL 8.0+, validate the plan, and recover safely.