Search Postgresql Archives

about cursors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I never used cursors before, and I'm trying to understand how to use
them well.

Postgresql doc says "a cursor that encapsulates the query, and then read
the query result a few rows at a time." So, when I open a cursor, is all
the query executed and results are returned a few a time?

My doubt comes from
http://archives.postgresql.org/pgsql-sql/2005-08/msg00230.php where I
read "when you open a cursor PostgreSQL doesn't know how many
rows it will return". So I start thinking that maybe it does not execute
the whole query....

At this point I'm not able to understand any more if cursor are useful
to reduce computational needs compared to running the same query each
time with limit and offset.

One last question: what happens to unclosed cursors? I mean, suppose an
application opens a cursor and crashes. What happens to that cursor? Is
there a way to close idle cursors?

Thanks.

-- 
Non c'e' piu' forza nella normalita', c'e' solo monotonia.

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux