From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-performance@postgresql.org
Subject: Re: Bypassing useless ORDER BY in a VIEW
Date: Thu, 28 Feb 2008 16:52:15 -0500
Message-ID: <16851.1204235535@sss.pgh.pa.us> (raw)
In-Reply-To: <47C6F8EE.1080409@ultimeth.com>
References: <36af4bed0802280631ja29c636w2256fb329e14b95e@mail.gmail.com>
<8366.1204218820@sss.pgh.pa.us>
<47C6F8EE.1080409@ultimeth.com>
"Dean Gibson (DB Administrator)" <postgresql@ultimeth.com> writes:
> Of course, where ORDER BY in a VIEW is really helpful, is with OFFSET
> and/or LIMIT clauses (which are also PostgreSQL extensions), which is
> equivalent to what you point out.
Right, which is the main reason why we allow it. I think that these
are sort of poor man's cases of things that SQL2003 covers with
"windowing functions".
The SQL spec treats ORDER BY as a cosmetic thing that you can slap onto
the final output of a SELECT. They don't consider it useful in
subqueries (including views) because row ordering is never supposed to
be a semantically significant aspect of a set of rows.
regards, tom lane
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
Subject: Re: Bypassing useless ORDER BY in a VIEW
In-Reply-To: <16851.1204235535@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