Re: Use case stuck due to Partitioning

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Shubham Mittal <mittalshubham30(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Use case stuck due to Partitioning
Date: 2021-06-28 21:51:06
Message-ID: CAHOFxGqB0_5LqkcYFFKDCDU+i1Diu-dzjZ+o4d5J8S-fJRVmwg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am unclear exactly what you want to do with modified_date. Can you write
pseudo code perhaps?

It sounds like you are wanting to union all the results of the query you
gave, with the results of a similar query where modified_date >=
'2021-03-01 08:16:13.589' and created_at < '2021-03-01 08:16:13.589'.

However, if modified date is not null, and is set to the created_date by
default, then there seems no reason to check the created_date except if
partition pruning at plan time is very important.

Are you experiencing an actual performance problem, are you unsure how to
write the query for the data you want, or is this premature optimization?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2021-06-28 21:52:28 Re: ALTER TABLE ... DETACH PARTITION just sitting there
Previous Message Alvaro Herrera 2021-06-28 21:19:02 Re: ALTER TABLE ... DETACH PARTITION just sitting there