Skip site navigation (1) Skip section navigation (2)

Re: [planner] Ignore "order by" in subselect if parrent do count(*)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig James <cjames(at)emolecules(dot)com>
Cc: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, "Marcin Miros*aw" <marcin(at)mejor(dot)pl>, pgsql-performance(at)postgresql(dot)org
Subject: Re: [planner] Ignore "order by" in subselect if parrent do count(*)
Date: 2012-03-01 21:29:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Craig James <cjames(at)emolecules(dot)com> writes:
> On Thu, Mar 1, 2012 at 9:50 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

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

In response to

pgsql-performance by date

Next:From: Stefan KellerDate: 2012-03-01 22:52:48
Subject: Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?
Previous:From: Tom LaneDate: 2012-03-01 21:18:00
Subject: Re: Bad estimation for "where field not in"

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group