Re: [PERFORM] Bypassing useless ORDER BY in a VIEW

2008-02-28 Thread Tom Lane
"Dean Gibson (DB Administrator)" <[EMAIL PROTECTED]> 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 thi

Re: [PERFORM] Bypassing useless ORDER BY in a VIEW

2008-02-28 Thread Dean Gibson (DB Administrator)
On 2008-02-28 09:13, Tom Lane wrote: A rule of thumb is that ORDER BY in a view is bad design, IMHO. regards, tom lane I was surprised to find out that apparently it's also a PostgreSQL extension; standard SQL apparently disallows ORDER BY in VIEWs: http://en.wik

Re: [PERFORM] PG planning randomly ?

2008-02-28 Thread Laurent Raufaste
2008/2/27, Tom Lane <[EMAIL PROTECTED]>: > > Are you sure the table had been analyzed recently at all on that server? > > If it had, then what you must be dealing with is a different result from > a different random sample. The laws of statistics say that sometimes a > random sample won't be ve

Re: [PERFORM] Bypassing useless ORDER BY in a VIEW

2008-02-28 Thread Tom Lane
"Robins Tharakan" <[EMAIL PROTECTED]> writes: > If I give an ORDER BY clause in a VIEW and then use it in another query > where the VIEW's ORDER BY is immaterial, would the planner be able to > discard this ORDER BY clause ? No. That's a feature not a bug; the sorts of cases where you want an ORD

[PERFORM] Bypassing useless ORDER BY in a VIEW

2008-02-28 Thread Robins Tharakan
Hi, While designing a complex database structure I wanted to ask a basic question about views. If I give an ORDER BY clause in a VIEW and then use it in another query where the VIEW's ORDER BY is immaterial, would the planner be able to discard this ORDER BY clause ? Any pointers / feedbacks wou