opt: ensure statistics builder correctly estimates selectivity of b @> '[]' and b @> '{}' #56870
Labels
A-sql-optimizer
SQL logical planning and optimizations.
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
C-performance
Perf of queries or internals. Solution not expected to change functional behavior.
Prior to #56732, queries like
SELECT * from d where b @> '[]';
andSELECT * from d where b @> '{}';
would cause a full scan of the primary index, even if there was an inverted index on columnb
.After #56732, the optimizer now plans an inverted index scan for these queries followed by an inverted filter. This is a very bad plan, however, because
b @> '[]'
andb @> '{}'
cause a full scan of the inverted index. The statistics builder should be taught that this is the case so that the optimizer will never choose an inverted index scan with these predicates.The text was updated successfully, but these errors were encountered: