Re: checking for a NULL date in a partitioned table kills performance

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Sbob <sbob@quadratum-braccas.com>
Cc: Rui DeSousa <rui.desousa@icloud.com>, "pgsql-performance@lists.postgresql.org" <pgsql-admin@lists.postgresql.org>
Date: 2024-08-23T00:01:37Z
Lists: pgsql-performance
On Thu, Aug 22, 2024 at 4:32 PM Sbob <sbob@quadratum-braccas.com> wrote:

>
> 29 million of the 32 million rows in the table have NULL for contract_date
>
>
Your expectation that this query should use an index is flawed.  Indexes
are for highly selective queries.  Finding nulls on that table is not
selective.

David J.