Skip to content

opt: infinite recursion between EliminateGroupByProject and PruneGroupByCols #100478

@mgartner

Description

@mgartner

Some queries can cause the optimizer to recurse indefinitley between two normalization rules, EliminateGroupByProject and PruneGroupByCols. Below is an optimizer test that reproduces the infinite recursion:

exec-ddl
CREATE TABLE p (
  region STRING NOT NULL,
  id INT,
  PRIMARY KEY (region, id),
  UNIQUE INDEX p_id_idx (id)
)
----

exec-ddl
CREATE TABLE c (
  region STRING NOT NULL,
  id INT PRIMARY KEY,
  p_id INT NOT NULL,
  FOREIGN KEY (region, p_id) REFERENCES p (region, id)
)
----

norm
SELECT p.id FROM p JOIN c ON p_id = p.id GROUP BY p.id
----

Jira issue: CRDB-26457

Metadata

Metadata

Assignees

Labels

A-sql-optimizerSQL logical planning and optimizations.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.GA-blockerT-sql-queriesSQL Queries Teambranch-release-23.1Used to mark GA and release blockers, technical advisories, and bugs for 23.1v23.1.2

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions