Re: cursor with hold must be save to disk?

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: cursor with hold must be save to disk?
Дата
Msg-id 536e4668-7c3a-c474-c819-5f10c31c61bb@aklaver.com
обсуждение исходный текст
Ответ на cursor with hold must be save to disk?  (黄宁 <huangning0722@gmail.com>)
Ответы Re: cursor with hold must be save to disk?  (黄宁 <huangning0722@gmail.com>)
Список pgsql-general
On 4/14/23 04:04, 黄宁 wrote:
> i want to use cursor with hold ,but when I declare a curosr , it takes a 
> long time to save the result set to disk. can i save the query state in 
> memory? and fetch forward the next result.
> 

 From the docs:

https://www.postgresql.org/docs/current/sql-declare.html

A cursor created with WITH HOLD is closed when an explicit CLOSE command 
is issued on it, or the session ends. In the current implementation, the 
rows represented by a held cursor are copied into a temporary file or 
memory area so that they remain available for subsequent transactions.

So I am going to guess the cursor query is holding a large amount of data.

To get a more specific answer you will need to provide:

1) Postgres version.

2) The complete DECLARE command being used.

3) An indication of the amount of data being retrieved.

4) The actual time for a 'long time'.

-- 
Adrian Klaver
adrian.klaver@aklaver.com




В списке pgsql-general по дате отправления:

Предыдущее
От: Marc Millas
Дата:
Сообщение: SIze 0 in pg_stat_file, pg_stat_progress_copy
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: cursor with hold must be save to disk?