Re: Fwd: Index on table when using DESC clause

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Yves Vindevogel <yves(dot)vindevogel(at)implements(dot)be>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Fwd: Index on table when using DESC clause
Date: 2005-05-23 19:46:38
Message-ID: Pine.GSO.4.62.0505232345390.2767@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

You didn't say what version of PostgreSQL you're trying.
I recall old version doesn't used index for backward pagination.

Oleg

On Mon, 23 May 2005, Yves Vindevogel wrote:

> I tried that, but
>
> create index ixTest on table1 (pages desc, documentname)
>
> gives me a syntax error
>
>
> On 23 May 2005, at 20:03, Steinar H. Gunderson wrote:
>
>> On Mon, May 23, 2005 at 07:41:19PM +0200, Yves Vindevogel wrote:
>>> However, when I query my db using for instance order by pages,
>>> documentname, it is very fast.
>>> If I use order by pages desc, documentname, it is not fast at
>>> all, like it is not using the index properly at all.
>>
>> Make an index on "pages desc, documentname asc".
>>
>> /* Steinar */
>> --
>> Homepage: http://www.sesse.net/
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: the planner will ignore your desire to choose an index scan if your
>> joining column's datatypes do not match
>>
>>
> Met vriendelijke groeten,
> Bien ? vous,
> Kind regards,
>
> Yves Vindevogel
> Implements
>
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andrew Lazarus 2005-05-23 20:27:15 Re: Fwd: Index on table when using DESC clause
Previous Message Yves Vindevogel 2005-05-23 19:02:17 Re: Fwd: Index on table when using DESC clause