Regarding query optimisation (select for update)

From: Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Regarding query optimisation (select for update)
Date: 2025-07-15 10:10:34
Message-ID: CAJCZko+fiU+=NSEGY7d7YMpFxg_jANpiO-LU6ur+yqRc_Ej6eQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Team,

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: image.png]

Do we have any alternative way to improve the performance?
Sometimes processed column use true as well as false

Regards,
Durga Mahesh

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Amol Inamdar 2025-07-15 11:35:04 Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)
Previous Message Laurenz Albe 2025-07-15 06:02:06 Re: Bypassing Directory Ownership Check in PostgreSQL 16.6 with Secure z/OS NFS (AT-TLS)