opt: improve cardinality estimate for lookup join that follows an inverted join #55448
Labels
C-performance
Perf of queries or internals. Solution not expected to change functional behavior.
T-sql-queries
SQL Queries Team
For an expression with an OR, the cardinality estimate for the lookup join does not realize that the inverted join is producing rows with the PK for the lookup, so the number of rows cannot increase. The following (for a table without stats) shows the
rows
increase from 10,000 to 333,333. If one changes the expression toST_Intersects(rtable.geom, ltable.geom1) AND ST_DWithin(ltable.geom1, rtable.geom, 2)
, the rows do not increase. In this case, one needs to force usage of the inverted index otherwise the optimizer prefers a cross join.Epic CRDB-16930
Jira issue: CRDB-3663
Jira issue: CRDB-13902
The text was updated successfully, but these errors were encountered: