Re: Bad perf when using DECLARE CURSOR on big table - Mailing list pgsql-performance

From kimaidou
Subject Re: Bad perf when using DECLARE CURSOR on big table
Date
Msg-id CAMKXKO4OoEaFcfTeZZOx_icTVdUN8a5LKs=VKTpVqQ-jv27Qww@mail.gmail.com
Whole thread Raw
In response to Re: Bad perf when using DECLARE CURSOR on big table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
Indeed, increasing cursor_tuple_fraction TO 0.2 did the trick.
Thanks for the hint Tom !

Le lun. 17 mars 2025 à 16:22, Tom Lane <tgl@sss.pgh.pa.us> a écrit :
kimaidou <kimaidou@gmail.com> writes:
> 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 !!

Raising cursor_tuple_fraction would probably help this case.

                        regards, tom lane

pgsql-performance by date:

Previous
From: Motog Plus
Date:
Subject: Background writer not active
Next
From: Adithya Kumaranchath
Date:
Subject: PostgreSQL 16 - Detach partition with FK - Error