Re: are cursors necessary?

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: are cursors necessary?
Дата
Msg-id 200312042331.18616.dev@archonet.com
обсуждение исходный текст
Ответ на are cursors necessary?  (Mark Harrison <mh@pixar.com>)
Ответы Re: are cursors necessary?
Список pgsql-general
On Thursday 04 December 2003 22:46, Mark Harrison wrote:
>     res = PQexec(conn, "BEGIN");
>     res = PQexec(conn, "DECLARE myportal CURSOR FOR select * from
> pg_database"); res = PQexec(conn, "FETCH ALL in myportal");
>     res = PQexec(conn, "CLOSE myportal");
>     res = PQexec(conn, "END");

> Is there any value in my own query-only programs to declaring the cursor
> for each search?

Well - if you want to scroll forward/backward through the resultset, you'd
want a cursor. Or, if your client had limited memory and the resultset was
large you might want to do so. PG will return all rows at once, so if your
SELECT returns 5 million rows you'll use a lot of RAM on the client side.

--
  Richard Huxton
  Archonet Ltd

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

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Money data type in PostgreSQL?