Use multi-variate MCV lists to estimate ScalarArrayOpExpr

Enterprise / PostgreSQL - Tomas Vondra [postgresql.org] - 14 March 2020 15:13 EDT

Commit 8f321bd16c added support for estimating ScalarArrayOpExpr clauses (IN/ANY) clauses using functional dependencies. There's no good reason not to support estimation of these clauses using multi-variate MCV lists too, so this commits implements that. That makes the behavior consistent and MCV lists can estimate all variants (ANY/ALL, inequalities, ...).

Author: Tomas Vondra Review: Dean Rasheed Discussion: https://www.postgresql.org/message-id/flat/13902317.Eha0YfKkKy%40pierred-pdoc

e83daa7e33 Use multi-variate MCV lists to estimate ScalarArrayOpExpr
src/backend/statistics/extended_stats.c | 66 +++++++++++++-
src/backend/statistics/mcv.c | 111 ++++++++++++++++++++++-
src/include/statistics/extended_stats_internal.h | 4 +-
src/test/regress/expected/stats_ext.out | 60 ++++++++++++
src/test/regress/sql/stats_ext.sql | 20 ++++
5 files changed, 252 insertions(+), 9 deletions(-)

Upstream: git.postgresql.org


  • Share