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 execute the query once. You only have parse/plan/initialise/execute the query once. For expensive queries this can be a huge saving. If you have a table with 10 million records, a cursor will only go through the table once. > 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 cursor dies with it... Have a nice day, -- Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Attachment:
signature.asc
Description: Digital signature