| From: | yudhi s <learnerdatabase99(at)gmail(dot)com> |
|---|---|
| To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
| Cc: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Nisarg Patel <er(dot)nisarg(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Question on execution plan and suitable index |
| Date: | 2026-02-16 12:22:32 |
| Message-ID: | CAEzWdqe6WwgRX4-GQHeePTUCdzHQ5-nMU0hHd9eGWV8ZS3kq0w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, Feb 16, 2026 at 5:22 PM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Durgamahesh Manne | 2026-02-16 13:24:44 | pgbouncer transaction pool mode issue for prepared statements |
| Previous Message | Laurenz Albe | 2026-02-16 11:52:20 | Re: Question on execution plan and suitable index |