Re: Multiple Order By Criteria

From: J(at)Planeti(dot)Biz
To: "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>, "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Multiple Order By Criteria
Date: 2006-01-17 23:03:04
Message-ID: 063d01c61bba$2d97fc00$681e140a@fatchubby
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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(at)megazone(dot)bigpanda(dot)com>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>; <J(at)planeti(dot)biz>
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
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2006-01-17 23:18:07 Re: Suspending SELECTs
Previous Message Josh Berkus 2006-01-17 22:59:02 Re: Suspending SELECTs