Re: Use case stuck due to Partitioning - Mailing list pgsql-general

From Shubham Mittal
Subject Re: Use case stuck due to Partitioning
Date
Msg-id CA+ERcR_QnczY013J-68i3av4tK2PkQevyPE2-T+AKCWUOt83DA@mail.gmail.com
Whole thread Raw
In response to Re: Use case stuck due to Partitioning  (Michael Lewis <mlewis@entrata.com>)
Responses Re: Use case stuck due to Partitioning
List pgsql-general
Hi Michael,

Yes I have a btree index on the modified_date column currently.

SELECT  *  FROM partitioned_table  where
 A ='Value'
AND created_date >= '2021-03-01 08:16:13.589' and created_date <= '2021-04-02 08:16:13.589'  ORDER BY viewpriority desc OFFSET 0 ROWS FETCH NEXT 200 ROWS ONLY;

Here viewpriority is basically a long value containing created_date in milliseconds.

Issue here is : I want to  somehow include modified_date also in this query to get the records sorted by modified_date . But that sorting will happen only in the specified created_date range only.  I want those latest modified records also whose created_date might not lie in this range.

Thanks 



On Tue, Jun 29, 2021 at 1:22 AM Michael Lewis <mlewis@entrata.com> wrote:
Do you have an index on the "updated_at" field and found that the query is too slow? Do you have an example query?

pgsql-general by date:

Previous
From: Michael Lewis
Date:
Subject: Re: Use case stuck due to Partitioning
Next
From: Ron
Date:
Subject: ALTER TABLE ... DETACH PARTITION just sitting there