X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B859C52887 for ; Mon, 23 May 2005 16:47:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90201-08 for ; Mon, 23 May 2005 19:47:10 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id CDF0952837 for ; Mon, 23 May 2005 16:47:00 -0300 (ADT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id j4NJkcpO020660; Mon, 23 May 2005 23:46:39 +0400 (MSD) Date: Mon, 23 May 2005 23:46:38 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Fwd: Index on table when using DESC clause In-Reply-To: Message-ID: References: <6d31bed04ab35cbbe2df37af979d9882@implements.be> <20050523180352.GA23486@uio.no> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.331 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200505/345 X-Sequence-Number: 12509 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