Re: BUG #5120: Performance difference between running a query with named cursor and straight SELECT - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5120: Performance difference between running a query with named cursor and straight SELECT
Date
Msg-id 11411.1255631118@sss.pgh.pa.us
Whole thread Raw
In response to BUG #5120: Performance difference between running a query with named cursor and straight SELECT  ("Steven McLellan" <smclellan@mintel.com>)
List pgsql-bugs
"Steven McLellan" <smclellan@mintel.com> writes:
> I've found what appears to be a bug seriously affecting performance running
> a particular query using a named cursor versus running it as a simple
> SELECT.

You haven't shown us a plan for the cursor case, but I'm thinking the
issue here is that Postgres prefers fast-start plans for cursors, on
the theory that if you're using a cursor you probably care more about
incremental fetching than the total elapsed time.  As of 8.4 you can
twiddle the strength of that preference via cursor_tuple_fraction.
http://www.postgresql.org/docs/8.4/static/runtime-config-query.html#GUC-CURSOR-TUPLE-FRACTION

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5118: start-status-insert-fatal
Next
From: Tom Lane
Date:
Subject: Re: BUG #5118: start-status-insert-fatal