Re: [GENERAL] about cursors

2007-06-17 Thread Ragnar
On lau, 2007-06-16 at 18:58 -0700, Ottavio Campana wrote: > Martijn van Oosterhout wrote: > > > > Cursors are attached to the transactio and session, if either ends, the > > cursor dies with it... > > > > Have a nice day, > > another question: > > since they live in a transaction, how can they

Re: [GENERAL] about cursors

2007-06-16 Thread Ottavio Campana
Martijn van Oosterhout wrote: >> 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? > > Cursors are attached to the transactio and session, if either ends, the > cu

Re: [GENERAL] about cursors

2007-06-16 Thread Martijn van Oosterhout
On Sat, Jun 16, 2007 at 09:58:27AM -0700, Ottavio Campana wrote: > 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. A cursor is generally much cheaper because you only execut

Re: [GENERAL] about cursors

2007-06-16 Thread Tom Lane
Ottavio Campana <[EMAIL PROTECTED]> writes: > 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 No, just enough to give you the rows you ask for. Otherwise the query state is hel