Re: Multiple Order By Criteria

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I created the index like this:

CREATE INDEX rcbee_idx
 ON detail_summary
 USING btree
 (receipt, carrier_id, batchnum, encounternum, encounter_id);

Is this correct ?

How do I make a reverse opclass ?

----- Original Message ----- From: "Stephan Szabo" <sszabo@xxxxxxxxxxxxxxxxxxxxx>
To: "Josh Berkus" <josh@xxxxxxxxxxxx>
Cc: <pgsql-performance@xxxxxxxxxxxxxx>; <J@xxxxxxxxxxx>
Sent: Tuesday, January 17, 2006 5:40 PM
Subject: Re: [PERFORM] Multiple Order By Criteria



On Tue, 17 Jan 2006, Josh Berkus wrote:

J,

> I have an index built for each of these columns in my order by clause.
> This query takes an unacceptable amount of time to execute. Here are > the
> results of the explain:

You need a single index which has all five columns, in order.

I think he'll also need a reverse opclass for the first column in the
index or for the others since he's doing desc, asc, asc, asc, asc.

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match




[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux