Find HAVING conditions that use no aggregate

Proprietary

A HAVING condition that references no aggregate forces the database to build every group before throwing unwanted ones away. The same condition in WHERE filters rows before grouping, doing strictly less work.

org.openrewrite.sql.antipattern.FindHavingWithoutAggregate

Optional

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.FindHavingWithoutAggregate

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.