Search Postgresql Archives

Re: select vs cursor/fetch speed disparity

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

 



Bosco Rama <postgres@xxxxxxxxxxxxx> writes:
> I have a strange disparity between a query that is run as a
> straight select and the same query via a cursor.  I hope I can
> jog someone's memory with the description as I have been unable
> to create a sanitized and/or reduced data set & schema that will
> reproduce this ... so far. :-(

Cursors are biased towards fast-start plans on the theory that you
may not be intending to fetch the whole result.  Queries with ORDER BY
and/or LIMIT are particularly likely to see plan changes as a
consequence of that.  In 8.4 and up you can frob the
cursor_tuple_fraction setting to adjust this preference.  Use
"EXPLAIN query" vs "EXPLAIN DECLARE CURSOR FOR query" to see what
sort of plan you're getting.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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