public inbox for [email protected]  
help / color / mirror / Atom feed
From: Doug Reynolds <[email protected]>
To: Pgsql-admin <[email protected]>
Subject: Re: checking for a NULL date in a partitioned table kills performance
Date: Fri, 23 Aug 2024 15:42:16 +0000
Message-ID: <010001917fe71552-589dbc9b-2c78-4a0d-8405-040db3cc09d7-000000@email.amazonses.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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 <[email protected]> wrote:
> 
> 
>> 
>> On Aug 23, 2024, at 5:39 AM, Doug Reynolds <[email protected]> wrote:
>> 
>> You could try something really ugly where you make a function index that COALESCEs the nulls to 1-1-1900 and use the COALESCE in 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'm sure you're right that no index would help. No matter what, it seems that sequential scans of all partitions will be required since most rows have it null, and it's not even related to the partition key.
> 






view thread (16+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: checking for a NULL date in a partitioned table kills performance
  In-Reply-To: <010001917fe71552-589dbc9b-2c78-4a0d-8405-040db3cc09d7-000000@email.amazonses.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox