pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <merlin.moncure@rcsonline.com>
Cc: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: spurious function execution in prepared statements.
Date: Thu, 30 Sep 2004 11:02:01 -0400
Message-ID: <16697.1096556521@sss.pgh.pa.us> (raw)
In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A74DF@Herge.rcsinc.local>
References: <6EE64EF3AB31D5448D0007DD34EEB3412A74DF@Herge.rcsinc.local>

"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:
> Here is the actual query:
> select lock_cuid(id), *
> ...
> 	order by wcl_vin_no, wcl_claim_no, id
> 	limit 1

Looks like Stephan made the right guess.

Logically the LIMIT executes after the ORDER BY, so the sorted result
has to be formed completely.  The fact that we are able to optimize
this in some cases does not represent a promise that we can do it in
all cases.  Ergo, it's not a bug.

			regards, tom lane



view thread (7+ messages)

Message-ID: <16697.1096556521@sss.pgh.pa.us>
Permalink:  ../16697.1096556521@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16697.1096556521@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, merlin.moncure@rcsonline.com, sszabo@megazone.bigpanda.com, pgsql-hackers@postgresql.org
  Subject: Re: spurious function execution in prepared statements.
  In-Reply-To: <16697.1096556521@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox