Re: checking for a NULL date in a partitioned table kills performance - Mailing list pgsql-admin

From Doug Reynolds
Subject Re: checking for a NULL date in a partitioned table kills performance
Date
Msg-id 010001917fe71552-589dbc9b-2c78-4a0d-8405-040db3cc09d7-000000@email.amazonses.com
Whole thread Raw
In response to Re: checking for a NULL date in a partitioned table kills performance  (Scott Ribe <scott_ribe@elevated-dev.com>)
Responses Re: checking for a NULL date in a partitioned table kills performance
List pgsql-admin
The only difference is that you would be reading from one index instead of two, which could be more efficient.


Sent from my iPhone

> On Aug 23, 2024, at 11:19 AM, Scott Ribe <scott_ribe@elevated-dev.com> wrote:
>
> 
>>
>> On Aug 23, 2024, at 5:39 AM, Doug Reynolds <mav@wastegate.net> wrote:
>>
>> You could try something really ugly where you make a function index that COALESCEs the nulls to 1-1-1900 and use the
COALESCEin the query. 
>
> I don't see how that could be better than just creating a partial index on it WHERE contract_date IS NULL--and anyway
I'msure you're right that no index would help. No matter what, it seems that sequential scans of all partitions will be
requiredsince most rows have it null, and it's not even related to the partition key. 
>




pgsql-admin by date:

Previous
From: Scott Ribe
Date:
Subject: Re: checking for a NULL date in a partitioned table kills performance
Next
From: "Wetmore, Matthew (CTR)"
Date:
Subject: Re: checking for a NULL date in a partitioned table kills performance