Re: Sorting a query on a view ignores an index

From: Mathieu De Zutter <mathieu(at)dezutter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Sorting a query on a view ignores an index
Date: 2003-08-21 16:24:48
Message-ID: 20030821162448.GC973@pleyel.kotnet.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Aug 21, 2003 at 10:59:11AM -0400, Tom Lane wrote:
> Mathieu De Zutter <mathieu(at)dezutter(dot)org> 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 query will try to sort
> > _again_ _without_ index and thus lose all performance.
>
> This is a limitation of the 7.3 query planner. 7.4 should do better.

Ok I'll have to live with that I guess.
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 slower.

With kind regards,

Mathieu

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bill Moran 2003-08-21 16:27:41 Re: Tests
Previous Message Shridhar Daithankar 2003-08-21 14:59:20 Re: Tests