pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Craig James <cjames@emolecules.com>
Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: Marcin Miros*aw <marcin@mejor.pl>
Cc: pgsql-performance@postgresql.org
Subject: Re: [planner] Ignore "order by" in subselect if parrent do count(*)
Date: Thu, 01 Mar 2012 16:29:24 -0500
Message-ID: <17997.1330637364@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFwQ8rfuNATduYJAm8PJbO+arsvP-uFXEvmi6n-f6Q9A_QaESQ@mail.gmail.com>
References: <4F4F6158.7060200@mejor.pl>
	<4F4F54910200002500045D59@gw.wicourts.gov>
	<14667.1330624202@sss.pgh.pa.us>
	<CAFwQ8rfuNATduYJAm8PJbO+arsvP-uFXEvmi6n-f6Q9A_QaESQ@mail.gmail.com>

Craig James <cjames@emolecules.com> writes:
> On Thu, Mar 1, 2012 at 9:50 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Considering that ORDER BY in a subquery isn't even legal per spec,

> That's surprising ... normally it won't affect the result, but with an
> offset or limit it would.  Does the offset or limit change the "not
> even legal" part?

Well, actually, the SQL standard didn't have anything comparable to
offset/limit until SQL:2008, either.  But I have to take back my
statement above.  It wasn't legal in SQL99, but evidently they added it
in the 2003 or 2008 edition, presumably to go with the limit
functionality.

Anyway, the long and the short of it is that people depend on ORDER BY
in subqueries to be honored, and we're not going to break that.

			regards, tom lane



view thread (9+ messages)

Message-ID: <17997.1330637364@sss.pgh.pa.us>
Permalink:  ../17997.1330637364@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17997.1330637364@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, cjames@emolecules.com, Kevin.Grittner@wicourts.gov, marcin@mejor.pl
  Subject: Re: [planner] Ignore "order by" in subselect if parrent do count(*)
  In-Reply-To: <17997.1330637364@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