public inbox for [email protected]
help / color / mirror / Atom feedFrom: Durgamahesh Manne <[email protected]>
To: PostgreSQL mailing lists <[email protected]>
To: Greg Sabino Mullane <[email protected]>
Subject: Fwd: Inefficient use of index scan on 2nd column of composite index during concurrent activity
Date: Fri, 11 Oct 2024 19:01:50 +0530
Message-ID: <CAJCZkoKEA4ZcYq0ereB2vFUQ+RQ8o2CEAUu5a4p-_ijuUvFL0g@mail.gmail.com> (raw)
In-Reply-To: <CAJCZkoL3E5M7taGpdtJRhwM0zCQ1-T2uzv4FKj_Arrz-fRusOQ@mail.gmail.com>
References: <CAJCZkoL3E5M7taGpdtJRhwM0zCQ1-T2uzv4FKj_Arrz-fRusOQ@mail.gmail.com>
---------- Forwarded message ---------
From: Durgamahesh Manne <[email protected]>
Date: Mon, Oct 7, 2024 at 10:01 AM
Subject: Inefficient use of index scan on 2nd column of composite index
during concurrent activity
To: <[email protected]>
Hi team
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 ?
Hope everyone understand this
Regards,
Durga Mahesh
Hi Greg
you mentioned that below
(please start a new thread in the future rather than replying to an
existing one)
You cannot query on b and use an index on (a,b) as you observed. However,
you can have two indexes:
index1(a)
index2(b)
Postgres will be able to combine those when needed in the case where your
WHERE clause needs to filter by both columns. So then you no longer need
the two-column index.
Hi Greg ,
Here not using composite index on ordinary table.
Composite index that i use on partitioned table is mandatory for use to
replicate data to target using pglogical (sorry this is not mentioned
earlier)
composite key (placedon,id)
In concurrent mode if i use id at where clause then query plan for that id
column changes
How to mitigate it rather than use seperate index for id to continue
without change in query plan (index scan) during concurrent activity
I hope you understand this
Regards,
Durga Mahesh
Cheers,
Greg
view thread (2+ 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]
Subject: Re: Fwd: Inefficient use of index scan on 2nd column of composite index during concurrent activity
In-Reply-To: <CAJCZkoKEA4ZcYq0ereB2vFUQ+RQ8o2CEAUu5a4p-_ijuUvFL0g@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