Re: [PERFORM] Sorting a query on a view ignores an index

2003-08-22 Thread alvis
Hello, Here is my exp. regarding VIEW (create VIEW view_name AS SELECT ) optimization. I have found strange (or at least not very intelligent) behavior of query planner (v.7.3.4). Given task is to take data from 14 tables, join, group, sort, etc. I currently use about ten views referencing ea

Re: [PERFORM] Sorting a query on a view ignores an index

2003-08-21 Thread Mathieu De Zutter
On Thu, Aug 21, 2003 at 01:02:08PM -0400, Tom Lane wrote: > Mathieu De Zutter <[EMAIL PROTECTED]> writes: > > Apart from avoiding views or subselects when sorting afterwards and > > putting the whole bunch in a huge SQL statement (which i'll have to > > produce on-the-fly), do you have an other alt

Re: [PERFORM] Sorting a query on a view ignores an index

2003-08-21 Thread Your Name
> Apart from avoiding views or subselects when sorting afterwards and > putting the whole bunch in a huge SQL statement (which i'll have to > produce on-the-fly), do you have an other alternative? > The 2 seconds is way to much, as the database will eventually run on a > machine that is 10 times s

Re: [PERFORM] Sorting a query on a view ignores an index

2003-08-21 Thread Tom Lane
Mathieu De Zutter <[EMAIL PROTECTED]> writes: > Apart from avoiding views or subselects when sorting afterwards and > putting the whole bunch in a huge SQL statement (which i'll have to > produce on-the-fly), do you have an other alternative? See if you can avoid the subselects in the view's SELE

Re: [PERFORM] Sorting a query on a view ignores an index

2003-08-21 Thread Mathieu De Zutter
On Thu, Aug 21, 2003 at 10:59:11AM -0400, Tom Lane wrote: > Mathieu De Zutter <[EMAIL PROTECTED]> writes: > > However, i dont want the view to be presorted, but sort it in the > > queries that use the view. When I do that, the index I have on that > > field seems to be ignored. It stretches so far

Re: [PERFORM] Sorting a query on a view ignores an index

2003-08-21 Thread Tom Lane
Mathieu De Zutter <[EMAIL PROTECTED]> writes: > However, i dont want the view to be presorted, but sort it in the > queries that use the view. When I do that, the index I have on that > field seems to be ignored. It stretches so far that, when I sort the > view on A and sort the query on A too, the

[PERFORM] Sorting a query on a view ignores an index

2003-08-21 Thread Mathieu De Zutter
Hi, I'm having a performance problem in postgresql. I have a rather complex view (attached) which, on itself, executes very fast, as it should. Normally this view is unordered. When I order the view itself (see comments in attachment), the view executes with about the same speed since the field i