public inbox for [email protected]  
help / color / mirror / Atom feed
From: yudhi s <[email protected]>
To: Laurenz Albe <[email protected]>
Cc: Ron Johnson <[email protected]>
Cc: Adrian Klaver <[email protected]>
Cc: Nisarg Patel <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Question on execution plan and suitable index
Date: Mon, 16 Feb 2026 17:52:32 +0530
Message-ID: <CAEzWdqe6WwgRX4-GQHeePTUCdzHQ5-nMU0hHd9eGWV8ZS3kq0w@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAEzWdqeGj9FcubNXegJ8PGTnXNahUhgc6T+yNFW7O12EkKR9yA@mail.gmail.com>
	<[email protected]>
	<CAEzWdqfxtEzxO10Rnr0Yw+tPJMtCuu2c2e1mr6bEzuYL1U1BvA@mail.gmail.com>
	<[email protected]>
	<CAEzWdqdo14MgxC_XO+ah_7r-cyEJwfenSAyve1tAeLaE+nwLZA@mail.gmail.com>
	<[email protected]>

On Mon, Feb 16, 2026 at 5:22 PM Laurenz Albe <[email protected]>
wrote:

> On Mon, 2026-02-16 at 16:09 +0530, yudhi s wrote:
> > I have updated the plan below. While trying to replace actual binds and
> > the objects with sample names some lines got missed initially it seems.
> >
> >
> https://gist.github.com/databasetech0073/f564ac23ee35d1f0413980fe4d00efa9
>
> Thanks.
>
> Does the filter on "due_date" eliminate many rows in "orders"?  If yes,
> and an index on that column would actually perform better (which you
> could test with enable_seqscan = off), perhaps your "random_page_cost"
> parameter is set too high.
>
> Where you can certainly make a difference is the repeated scan on
> "event_audit_log".  An index on (request_id, event_comment_text,
> created_at)
> should speed up that part.
>
> Yours,
> Laurenz Albe
>

Thank you so much. Will try this one.

Regarding the composite index on (request_id, event_comment_text,
created_at) for table event_audit_log, is there any advice, which we should
follow for keeping "date column"(like column "Created_at" here) in the
indexing order (apart from the frequency of usage in the query)?

And to help the table scan of the ORDER table, should we also have
"entity_id" added to the index along with "due_date" i.e. a composite index
on (entity_id,due_date)?

Regards
Yudhi


view thread (7+ 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], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Question on execution plan and suitable index
  In-Reply-To: <CAEzWdqe6WwgRX4-GQHeePTUCdzHQ5-nMU0hHd9eGWV8ZS3kq0w@mail.gmail.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