Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vrxcs-00F2Sw-1U for pgsql-general@arkaria.postgresql.org; Mon, 16 Feb 2026 12:22:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vrxcr-002FEm-0s for pgsql-general@arkaria.postgresql.org; Mon, 16 Feb 2026 12:22:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vrxcq-002FEZ-32 for pgsql-general@lists.postgresql.org; Mon, 16 Feb 2026 12:22:53 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vrxco-0000000113u-3g1y for pgsql-general@lists.postgresql.org; Mon, 16 Feb 2026 12:22:52 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-6581234d208so5133269a12.3 for ; Mon, 16 Feb 2026 04:22:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771244570; cv=none; d=google.com; s=arc-20240605; b=LKAUOyn8gqqwrAbiXwDCl0Dg/PNaaso90Wp7LiGumgpT312bJihfQzpSYQR6tF4Bqv z36VhjaxJCCSO5R774Dn8Vv+8V8v9Nl01Z5S67wzHLQGQy8xHdEmgktkKjDaGsCFvlxU pqY17ayKBFsAqcGaX19BzBoc0saQ6AOP/Ia8cMkspHkAfLEoLCnuvRMMXcfZASy1pFO0 iSg+JSEFKk3QeWahtaGd86iYiAVPD0WCqsDj+enwHjM6a6A0UYa/lMDYlMZaHUFBkCNN vXhdapXpWZ8TpMfWKFywnOreg3TNf/jcD8xYpIptJRt6imfu4R/6r1XOG8iJ3LjC71LE C9Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=MGNyR2xkNJh5vca0GbvW+UvLFbGsk9aUW3E6zvwZ3wQ=; fh=TrK5bdX0EFKUouSvLcro1k7YRBM0YY71T/9bN2GpyLE=; b=cCmOPw0hwIpYrG+yoLud220h9/idNS8a4cZWm/oRDD3sny8IEa9XhE+UpCDPu6DeKx kStvzRI6WjwcfBPh4mm5B7dbw5H6nPUO5OPZZmilFb9FH+mVKohPqybsn/1WQIWQsBaO DoSV4/j9woxuSlu8yZD6CpHKAWWUHllZ2y8AuuaBHIMZja1r/CcLA4BLiiwFqWrQbmg7 6JG2ciO0YcB2TQmLODXATYFwyVQ6ihT+a5nB5V0/5slAUNp5NcDhlCKHQa1G9XZcoXvZ +L5iSqF4mnwEcthySk5yNzxiy2b51A2NRK68R3fN6BIOEuMwf0Zt+0F0DPFJEJMFLfBO S9bw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771244570; x=1771849370; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MGNyR2xkNJh5vca0GbvW+UvLFbGsk9aUW3E6zvwZ3wQ=; b=RdpETVHEjaYnLPbEdjVvn56kXBSbeRM9QSf93RTBzEB2adPQWYhakWa6yH8lGabGIx 27Cp6ubyRs/ar/lMgh0HX+uzQNO0mMeH4DRxSYIxjqnIcW4Suv5uMA5g/rU3JoITpvgh gt1a1NfspaGpRBM0Fl6ueq88tf0H6NcbbA7E5fhZiqMFTO25w5AK6X/OjJu74XnZ9Km9 LNiS1w6U4JtuRFCV9ZHVTEyYu0LKZt0u7gVbhYk2cexDlOM0CZSzckj9fuIwB57a8q6J 3IwAn/C0BUimXXfQb7yZMYScL6RpRgvc1BDVH7CVyFN+6dt1vOqBYEoGYu821RCO32ia EHNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771244570; x=1771849370; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MGNyR2xkNJh5vca0GbvW+UvLFbGsk9aUW3E6zvwZ3wQ=; b=WJNxiXdT3iUBdh02Obq/in0/uIRVyesiDEqxJKNmG8sgu6+F2UuykfwNaCOGwO6WsP nrRqBhRHIn3/gUnFVhhOKK9dbnGhrKQhvFfq9qPK+BRfkCHEGR6RBLPcFtDjokePhDhu LpReJW732BuavcUAlwHUqlmg40xD6LBr+Aef1OlbkatpWWXLZ8umbf/wpOFqF/eXX1dE jR30dKacI2mD67w3h/vn6lHoNk20zQ2GARvT64U4FnYDYji7IUTd6v3r61+5hjW+MNPz lcxaTTmASsNE9dbry3thztB9YMonqT4Dh58+qpzqOlRN2xDjXZoi6DIFA8nEq/bLX844 ZauA== X-Forwarded-Encrypted: i=1; AJvYcCXoSz6zoLX17NWYb5aO0RKc8zGl1OxEc15TtwEWAywH90CuGhufEKqr5sPLKA6rtOHlCulhtwxazj+rIXAE@lists.postgresql.org X-Gm-Message-State: AOJu0YxtoCgbOlMyBgrzAkHjAZe69gSFYZkn99v94gy12WilMl99E2zA g6VAF/jH/pV2xfwWHNohyroNsKtPh21oLz6R36PqFxzXdhcxgeN6BzpiaZLdtOW0solOjxwJGIY iLoXqpbtz7dlG/+S36q/+D1DQv8rk+dvMEi1v X-Gm-Gg: AZuq6aL3K2hATYHaL0Dp8t5qE4t2giOvnzDGxbxOfm4MrIzcvV1seTzHocNGCh3tl37 dNjfG29zb0Ti/Lognwc9XEk/zBP8SGXlo7DUq8r4ul1suvIIJgaz8JQa+C9xhkBEGv46ka7Ftx4 oEjBDMy0rqDo+13Mh3oN4efaWi0aCHyp8m9F0LYymN8Jh3HlZEL53CDchfnl/GvdEgxEE6UvX7i jKb+jbtMuhzvUBXAPN8TrQTzOzZu0ZdPsuWbteVyO/cMcN2rlsIv+4AqBTjHS4tzgFbiUyIWsPy 1A0tS1rXHQLXhp0Od1c3w67Uoe9j8++bs3xsGQSY3Q== X-Received: by 2002:a05:6402:4406:b0:65a:16fc:d86 with SMTP id 4fb4d7f45d1cf-65bc7a80f0dmr3440849a12.28.1771244569860; Mon, 16 Feb 2026 04:22:49 -0800 (PST) MIME-Version: 1.0 References: <818d0359d8b629a80b55b2e068dab958fc8e0a2a.camel@cybertec.at> <2fa62200cf92dc03dff20f8a42e45bb30fc40f35.camel@cybertec.at> In-Reply-To: From: yudhi s Date: Mon, 16 Feb 2026 17:52:32 +0530 X-Gm-Features: AaiRm53m9jQ0hII6Vwjf6P9U2BHq7LWMs3YmOxGpZ7k_N025IJ6UBZ1pNVA7z30 Message-ID: Subject: Re: Question on execution plan and suitable index To: Laurenz Albe Cc: Ron Johnson , Adrian Klaver , Nisarg Patel , pgsql-general Content-Type: multipart/alternative; boundary="000000000000659d18064af003bf" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000659d18064af003bf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 16, 2026 at 5:22=E2=80=AFPM Laurenz Albe 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 =3D 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 --000000000000659d18064af003bf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Feb 16,= 2026 at 5:22=E2=80=AFPM Laurenz Albe <laurenz.albe@cybertec.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 an= d
> the objects with sample=C2=A0names some lines got missed initially=C2= =A0it seems.
>
> https://gist.github.co= m/databasetech0073/f564ac23ee35d1f0413980fe4d00efa9=C2=A0

Thanks.

Does the filter on "due_date" eliminate many rows in "orders= "?=C2=A0 If yes,
and an index on that column would actually perform better (which you
could test with enable_seqscan =3D off), perhaps your "random_page_cos= t"
parameter is set too high.

Where you can certainly make a difference is the repeated scan on
"event_audit_log".=C2=A0 An index on (request_id, event_comment_t= ext, created_at)
should speed up that part.

Yours,
Laurenz Albe

Thank you so much. Will tr= y this one.

Regarding the composite index on (requ= est_id, event_comment_text, created_at) for table event_audit_log, is there= any advice, which we should follow for keeping "date column"(lik= e 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" a= dded to the index along with "due_date" i.e. a composite index on= (entity_id,due_date)?

Regards
Yudhi
--000000000000659d18064af003bf--