Re: Use extended statistics to estimate (Var op Var) clauses

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use extended statistics to estimate (Var op Var) clauses
Date: 2021-08-20 18:36:56
Message-ID: 635C993A-265E-4A1B-BACA-A90CDBA8440C@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Aug 20, 2021, at 11:20 AM, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> wrote:
>
> I think we can either reject the patch, which would mean we don't consider (Var op Var) clauses to be common/important enough. 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. The patch 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-08-20 18:40:33 Re: archive status ".ready" files may be created too early
Previous Message Tomas Vondra 2021-08-20 18:20:50 Re: Use extended statistics to estimate (Var op Var) clauses