"Josh Berkus" <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to