public inbox for [email protected]
help / color / mirror / Atom feedFrom: kimaidou <[email protected]>
To: postgres performance list <[email protected]>
Subject: Bad perf when using DECLARE CURSOR on big table
Date: Mon, 17 Mar 2025 15:41:07 +0100
Message-ID: <CAMKXKO6_evfQp80xx5tFkoziHW+62mHg=YKenUEb5VTdnXT=Sg@mail.gmail.com> (raw)
Hi list !
I have a simple but big spatial table with approx 93 000 000 lines.
I use QGIS, the open-source GIS software to display this data. To fetch the
polygons to draw on QGIS map, QGIS launch a first DECLARE CURSOR query,
then fetch data 2000 by 2000.
I have seen that this DECLARE has bad perf compared to a simple SQL query :
Simple SQL query
=====
https://explain.dalibo.com/plan/042bc4dc2449adfe
96ms
DECLARE CURSOR for the same query
=====
https://explain.dalibo.com/plan/bh83fc0db500a79g#
171 031 ms !!
Do you have any clue about this query plan ? Should I add some table
specific weight, stats, etc. to help the DECLARE clause to use the indexes
as done for the simple SELECT ?
Regards
Michaƫl
view thread (3+ 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]
Subject: Re: Bad perf when using DECLARE CURSOR on big table
In-Reply-To: <CAMKXKO6_evfQp80xx5tFkoziHW+62mHg=YKenUEb5VTdnXT=Sg@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