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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Sbob <sbob(at)quadratum-braccas(dot)com>
Cc: Rui DeSousa <rui(dot)desousa(at)icloud(dot)com>, "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: checking for a NULL date in a partitioned table kills performance
Date: 2024-08-23 00:01:37
Message-ID: CAKFQuwZKTiS5b_Loe21p9rFBzR5XriHODPeocP40QAECTHEMkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

On Thu, Aug 22, 2024 at 4:32 PM Sbob <sbob(at)quadratum-braccas(dot)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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2024-08-23 00:05:19 Re: checking for a NULL date in a partitioned table kills performance
Previous Message Sbob 2024-08-22 23:32:18 Re: checking for a NULL date in a partitioned table kills performance

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2024-08-23 00:05:19 Re: checking for a NULL date in a partitioned table kills performance
Previous Message Vitalii Tymchyshyn 2024-08-22 23:54:19 Re: checking for a NULL date in a partitioned table kills performance (accidentally sent to the admin list before)