Re: psql's FETCH_COUNT (cursor) is not being respected for CTEs

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql's FETCH_COUNT (cursor) is not being respected for CTEs
Date: 2023-01-04 15:57:28
Message-ID: CA+TgmoY+dtzL-AxgdjaZ7HS=AXr1Sd6w-ZCg9uCjW9dvoDZPrQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 4, 2023 at 10:22 AM Daniel Verite <daniel(at)manitou-mail(dot)org> wrote:
> A solution would be for psql to use PQsetSingleRowMode() to retrieve
> results row-by-row, as opposed to using a cursor, and then allocate
> memory for only FETCH_COUNT rows at a time. Incidentally it solves
> other problems like queries containing multiple statements, that also
> fail to work properly with cursors, or UPDATE/INSERT... RETURNING.. on
> large number of rows that could also benefit from pagination in
> memory.

Is there any reason that someone hasn't, like, already done this?

Because if there isn't, we should really do this. And if there is,
like say that it would hurt performance or something, then we should
come up with a fix for that problem and then do something like this.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-01-04 16:36:51 Re: psql's FETCH_COUNT (cursor) is not being respected for CTEs
Previous Message Ankit Kumar Pandey 2023-01-04 15:30:50 Re: Todo: Teach planner to evaluate multiple windows in the optimal order