From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Hey! ORDER BY in VIEWS? |
Date: | 2001-07-15 21:50:23 |
Message-ID: | 11521.995233823@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
"Josh Berkus" <josh(at)agliodbs(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Ruprecht | 2001-07-16 02:05:43 | Unknown values in int8 fields? |
Previous Message | Josh Berkus | 2001-07-15 21:40:30 | Re: Hey! ORDER BY in VIEWS? |