From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Hey! ORDER BY in VIEWS?
Date: Sun, 15 Jul 2001 17:50:23 -0400
Message-ID: <11521.995233823@sss.pgh.pa.us> (raw)
In-Reply-To: <web-85979@davinci.ethosmedia.com>
References: <web-85979@davinci.ethosmedia.com>
"Josh Berkus" <josh@agliodbs.com> writes:
>> Hmm, I just realized that there's a bug here: let's say you have
>>
>> CREATE VIEW latest AS
>> SELECT * FROM news ORDER BY story_timestamp DESC LIMIT 1;
>>
>> ie, this view gives you the latest news story.
> Why, exactly, do we need to support ORDER BY ... LIMIT in VIEWS, anyway?
> I'm frankly unclear on the utility of this ...
I think the above example is pretty compelling, don't you? Easy to read
and it generates a very nice indexscan plan.
> If we gotta have 'em, though, Tom, you'd have to code in an exception to
> the VIEW optimizer that doesn't push down WHERE clauses if the VIEW has
> an ORDER BY ... LIMIT statement. Sure you wanna get into this?
It's a one-line addition to code that already knows that certain kinds
of clauses (like UNION) prevent pushdown. Just an oversight, not a
fundamental flaw.
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-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com, peter_e@gmx.net
Subject: Re: Hey! ORDER BY in VIEWS?
In-Reply-To: <11521.995233823@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