Re: Use extended statistics to estimate (Var op Var) clauses - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: Use extended statistics to estimate (Var op Var) clauses
Date
Msg-id 635C993A-265E-4A1B-BACA-A90CDBA8440C@enterprisedb.com
Whole thread Raw
In response to Re: Use extended statistics to estimate (Var op Var) clauses  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
List pgsql-hackers

> On Aug 20, 2021, at 11:20 AM, Tomas Vondra <tomas.vondra@enterprisedb.com> wrote:
>
> I think we can either reject the patch, which would mean we don't consider (Var op Var) clauses to be
common/importantenough. Or we need to improve the existing selectivity functions (even those without extended
statistics)to handle those clauses in a smarter way. Otherwise there'd be strange/surprising inconsistencies. 

For datatypes with very few distinct values (bool, some enums, etc.) keeping an mcv list of (a,b) pairs seems helpful.
Thepatch may be worth keeping for such cases.  In other cases, I don't much see the point. 

It seems that sampling the fraction of rows where (A op B) is true for any given op would be more helpful.

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Use extended statistics to estimate (Var op Var) clauses
Next
From: Robert Haas
Date:
Subject: Re: archive status ".ready" files may be created too early