Re: Index usage for sorted query

From: Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com>
To: "Markus Schaber" <schabios(at)logi-track(dot)com>, "PostgreSQL Performance List" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Index usage for sorted query
Date: 2004-11-20 16:12:43
Message-ID: opshrtzhakcq72hf@musicbox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


Instead of :

> 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.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2004-11-20 16:48:16 Re: Index usage for sorted query
Previous Message Markus Schaber 2004-11-20 14:17:10 Index usage for sorted query