Re: libpq: How are result sets fetched behind the scene?

Поиск
Список
Период
Сортировка
От Christian Barthel
Тема Re: libpq: How are result sets fetched behind the scene?
Дата
Msg-id 87zhjg8eep.fsf@x230.onfire.org
обсуждение исходный текст
Ответ на Re: libpq: How are result sets fetched behind the scene?  (Sebastien FLAESCH <sf@4js.com>)
Ответы Re: libpq: How are result sets fetched behind the scene?
Список pgsql-sql
Sebastien FLAESCH <sf@4js.com> writes:

> Is the whole result set fetched to the client app, not matter what row
> number is provided to the first PQgetvalue() call (or similar API call
> on result set data or meta-data)?

I have tested this as well and came to the same result as you.
The entire result set seems to be fetched at once.
Attached is a test program: I have loaded 30MB of random strings
and did a simple SELECT on the random data.  I stopped the output
with getchar() and looked at the network traffic and the memory
usage with top(1).  Everything gets allocated and fetched at once
as far as I can see. 

However, I would not build an application that "depends" on this 
behavior.  I think that it is better to use a declared cursor and
use FETCH.
-- 
Christian Barthel <bch@online.de>


Вложения

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

Предыдущее
От: Karen Goh
Дата:
Сообщение: How do I enabled Windows 10 to be able to run PSQL etc
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: How do I enabled Windows 10 to be able to run PSQL etc