From: Oleg Bartunov <oleg@sai.msu.su>
To: Yves Vindevogel <yves.vindevogel@implements.be>
Cc: pgsql-performance@postgresql.org
Subject: Re: Fwd: Index on table when using DESC clause
Date: Mon, 23 May 2005 23:46:38 +0400 (MSD)
Message-ID: <Pine.GSO.4.62.0505232345390.2767@ra.sai.msu.su> (raw)
In-Reply-To: <c4e0898e4059f6d3333ee2e59fd5c788@implements.be>
References: <6d31bed04ab35cbbe2df37af979d9882@implements.be>
<20050523180352.GA23486@uio.no>
<c4e0898e4059f6d3333ee2e59fd5c788@implements.be>
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@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: oleg@sai.msu.su, yves.vindevogel@implements.be
Subject: Re: Fwd: Index on table when using DESC clause
In-Reply-To: <Pine.GSO.4.62.0505232345390.2767@ra.sai.msu.su>
References: <6d31bed04ab35cbbe2df37af979d9882@implements.be> <20050523180352.GA23486@uio.no> <c4e0898e4059f6d3333ee2e59fd5c788@implements.be> <Pine.GSO.4.62.0505232345390.2767@ra.sai.msu.su>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox