From: Tom Lane <tgl@sss.pgh.pa.us>
To: Danny Shemesh <dany74q@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: The use of partial, expressional indices in pg < 14
Date: Tue, 31 May 2022 10:29:35 -0400
Message-ID: <173501.1654007375@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFZC=QrQ4uahFengvML7nxQC0AoPdLGd2qhdTqFYAy_Ka6AjEg@mail.gmail.com>
References: <CAFZC=QrQ4uahFengvML7nxQC0AoPdLGd2qhdTqFYAy_Ka6AjEg@mail.gmail.com>
Danny Shemesh <dany74q@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, dany74q@gmail.com
Subject: Re: The use of partial, expressional indices in pg < 14
In-Reply-To: <173501.1654007375@sss.pgh.pa.us>
References: <CAFZC=QrQ4uahFengvML7nxQC0AoPdLGd2qhdTqFYAy_Ka6AjEg@mail.gmail.com> <173501.1654007375@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox