Find correlated aggregate subqueries in WHERE
ProprietaryA scalar subquery that computes an aggregate like MAX while referencing the outer query runs once per outer row on engines that cannot decorrelate it. A window function or a join to a pre-aggregated derived table computes every group in a single pass. Uncorrelated aggregate subqueries and EXISTS or IN subqueries are not flagged.
org. openrewrite. sql. antipattern. FindCorrelatedAggregateSubqueryOptional
markSourceBoolean
Whether to mark each occurrence in source, and apply the fix where the rule remediates. Defaults to true; set to false to leave source untouched and report only to the data table, as an analysis-only pipeline requires.
mod run . --recipe= org. openrewrite. sql. antipattern. FindCorrelatedAggregateSubqueryInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.