Re: Multiple Order By Criteria

From: Fredrick O Jackson <fred(at)arkansaswebs(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Cc: J(at)planeti(dot)biz
Subject: Re: Multiple Order By Criteria
Date: 2006-01-17 22:57:06
Message-ID: 200601171657.06542@bits.electronsrus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


try adding the keyword 'date' before the date in your query.
I ran into this quite a while back, but I'm not sure I remember the solution.

> In Reply to: Tuesday January 17 2006 04:29 pm, J(at)planeti(dot)biz J(at)planeti(dot)biz
wrote:
> I created the index, in order. Did a vacuum analyze on the table and my
> explain still says:
>
> Limit (cost=229610.78..229611.03 rows=100 width=717)
> -> Sort (cost=229610.78..230132.37 rows=208636 width=717)
> Sort Key: receipt, carrier_id, batchnum, encounternum, encounter_id
> -> Seq Scan on detail_summary ds (cost=0.00..22647.13 rows=208636
> width=717)
> Filter: (receipt >= '2004-03-22'::date)
>
>
> So, for fun I did
> set enable_seqscan to off
>
> But that didn't help. For some reason, the sort wants to do a seq scan and
> not use my super new index.
>
> Am I doing something wrong ?
>
> ----- Original Message -----
> From: "Josh Berkus" <josh(at)agliodbs(dot)com>
> To: <pgsql-performance(at)postgresql(dot)org>
> Cc: <J(at)planeti(dot)biz>
> Sent: Tuesday, January 17, 2006 5:25 PM
> Subject: Re: [PERFORM] Multiple Order By Criteria
>
> > 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.
> >
> >
> > --
> > --Josh
> >
> > Josh Berkus
> > Aglio Database Solutions
> > San Francisco
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2006-01-17 22:59:02 Re: Suspending SELECTs
Previous Message Frank Wiles 2006-01-17 22:51:15 Re: Suspending SELECTs