Re: Index usage for sorted query

From: Markus Schaber <schabios(at)logi-track(dot)com>
To: Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com>
Cc: "PostgreSQL Performance List" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Index usage for sorted query
Date: 2004-11-22 15:01:15
Message-ID: 20041122160115.30cced7b@kingfisher.intern.logi-track.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi, Pierre-Frédéric,

On Sat, 20 Nov 2004 17:12:43 +0100
Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com> wrote:

> > WHERE cd='ca' ORDER BY l_postcode;
>
> Write :
>
> > WHERE cd='ca' ORDER BY cd, l_postcode;
>
> You have a multicolumn index, so you should specify a multicolumn sort
> exactly the same as your index, and the planner will get it.

Thanks, that seems to help.

Seems weird to order by a column that is all the same value, but well,
why not :-)

Thanks a lot,
Markus

--
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios(at)logi-track(dot)com | www.logi-track.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Anjan Dave 2004-11-22 15:20:14 Re: Query Performance and IOWait
Previous Message Pierre-Frédéric Caillaud 2004-11-22 12:30:04 Re: memcached and PostgreSQL