public inbox for [email protected]  
help / color / mirror / Atom feed
From: David Rowley <[email protected]>
To: Durgamahesh Manne <[email protected]>
Cc: PostgreSQL mailing lists <[email protected]>
Cc: Greg Sabino Mullane <[email protected]>
Subject: Re: Inefficient use of index scan on 2nd column of composite index during concurrent activity
Date: Tue, 15 Oct 2024 22:45:19 +1300
Message-ID: <CAApHDvpy1Goh=tmZKDvJ+3Uqb69r8i3U09_m9+P4NBertCyVmw@mail.gmail.com> (raw)
In-Reply-To: <CAJCZkoKEA4ZcYq0ereB2vFUQ+RQ8o2CEAUu5a4p-_ijuUvFL0g@mail.gmail.com>
References: <CAJCZkoL3E5M7taGpdtJRhwM0zCQ1-T2uzv4FKj_Arrz-fRusOQ@mail.gmail.com>
	<CAJCZkoKEA4ZcYq0ereB2vFUQ+RQ8o2CEAUu5a4p-_ijuUvFL0g@mail.gmail.com>

On Sat, 12 Oct 2024 at 02:28, Durgamahesh Manne
<[email protected]> wrote:
> Second column of composite index not in use effectively with index scan  when using second column at where clause
>
> I have composite index on (placedon,id) of test
> When quering  select * from test where id = '4234';
> Value of id changes and during concurrent activity and cpu utilization increased toomuch  that i have observed which means query plan changed why
>
> I could see index scan with explain for it
>
> Is there any way to keep index scan for it during even on concurrency rather than seperate index on second column of composite index ?

It sounds like you might be asking about something we call "index skip
scans". Currently, PostgreSQL does not support these, however there is
work being done to add support and that might arrive in PG18.

There is some information about a possible workaround in [1] which may
be of use to you.

David

[1] https://wiki.postgresql.org/wiki/Loose_indexscan






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]
  Subject: Re: Inefficient use of index scan on 2nd column of composite index during concurrent activity
  In-Reply-To: <CAApHDvpy1Goh=tmZKDvJ+3Uqb69r8i3U09_m9+P4NBertCyVmw@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