Re: The use of partial, expressional indices in pg < 14

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Danny Shemesh <dany74q(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: The use of partial, expressional indices in pg < 14
Date: 2022-05-31 14:29:35
Message-ID: 173501.1654007375@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Danny Shemesh <dany74q(at)gmail(dot)com> writes:
> 2. Would it be theoretically possible to use the collected statistics if
> the index where clause is also specified in the query itself ?
> or in other words, if the index only contains records where x is not null,
> and the query also filters on x is not null, would the partial distribution
> not be safe to use ?

The hard part is to avoid double-counting the selectivity of the "is not
null" clause if you do that. It's something that would be nice to do
but it's much trickier than it sounds.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Hill 2022-05-31 14:53:01 Build Postgres On AIX
Previous Message Eric Katchan 2022-05-31 13:22:39 pgAdmin 4 v 6.9