Re: where+orderby+limit not (always) using appropriate index?

From: PFC <lists(at)boutiquenumerique(dot)com>
To: Szűcs Gábor <surrano(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: where+orderby+limit not (always) using appropriate index?
Date: 2005-05-18 15:06:51
Message-ID: op.sqy79pi8th1vuj@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> SELECT o FROM t WHERE i = 1 ORDER BY o LIMIT 1;

use :
ORDER BY i, o

If you have a multicol index and want to order on it, you should help the
planner by ORDERing BY all of the columns in the index...
It bit me a few times ;)

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-05-18 15:14:39 Re: where+orderby+limit not (always) using appropriate index?
Previous Message Szűcs Gábor 2005-05-18 14:30:17 where+orderby+limit not (always) using appropriate index?