Re: BUG #5120: Performance difference between running a query with named cursor and straight SELECT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Steven McLellan" <smclellan(at)mintel(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5120: Performance difference between running a query with named cursor and straight SELECT
Date: 2009-10-15 18:25:18
Message-ID: 11411.1255631118@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Steven McLellan" <smclellan(at)mintel(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Neill 2009-10-15 18:35:31 Re: Postgresql 8.4.1 segfault, backtrace
Previous Message Kevin Grittner 2009-10-15 18:21:12 Re: BUG #5118: start-status-insert-fatal