public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Durgamahesh Manne <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Regarding query optimisation (select for update)
Date: Tue, 15 Jul 2025 16:06:20 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAJCZkoLJ6G9J3iK591o35UaKu3x7Kn96ma-u_yqGNgkrLjf6ag@mail.gmail.com>
References: <CAJCZko+fiU+=NSEGY7d7YMpFxg_jANpiO-LU6ur+yqRc_Ej6eQ@mail.gmail.com>
<[email protected]>
<CAJCZkoLJ6G9J3iK591o35UaKu3x7Kn96ma-u_yqGNgkrLjf6ag@mail.gmail.com>
On Tue, 2025-07-15 at 18:26 +0530, Durgamahesh Manne wrote:
> On Tue, Jul 15, 2025 at 6:14 PM Laurenz Albe <[email protected]> wrote:
> > On Tue, 2025-07-15 at 15:40 +0530, Durgamahesh Manne wrote:
> > > We are facing issues with slow running query
> > > SELECT betid, versionid, betdata, processed, messagetime, createdat, updatedat
> > > FROM praermabetdata where processed = 'false'
> > > ORDER BY betid, versionid LIMIT 200 OFFSET 0 FOR UPDATE;
> > >
> > > QUERY PLAN
> > > --------------------------------------------------------------------------------------------------------------------------------
> > > Limit (cost=0.28..1.89 rows=1 width=78)
> > > -> LockRows (cost=0.28..1.89 rows=1 width=78)
> > > -> Index Scan using idx_praermabetdata_processed_betid_versionid on praermabetdata (cost=0.28..1.88 rows=1 width=78)
> > > Index Cond: (processed = false)
> > >
> > > image.png
> > >
> > > Do we have any alternative way to improve the performance?
> > > Sometimes processed column use true as well as false
> >
> > Please provide EXPLAIN (ANALYZE, BUFFERS) output and use "log_lock_waits"
> > to see if you are hanging behind locks for a longer time.
>
> image.png
Text is easier to read than images...
Anyway, this statement was done in under a millisecond.
I wouldn't call that slow...
Yours,
Laurenz Albe
view thread (6+ 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]
Subject: Re: Regarding query optimisation (select for update)
In-Reply-To: <[email protected]>
* 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