X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 30FAE9DC841 for ; Tue, 17 Jan 2006 18:29:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46579-07 for ; Tue, 17 Jan 2006 18:29:14 -0400 (AST) X-Greylist: delayed 00:25:37.625666 by SQLgrey- Received: from plain.rackshack.net (unknown [66.98.130.45]) by postgresql.org (Postfix) with ESMTP id 004D99DC80F for ; Tue, 17 Jan 2006 18:29:09 -0400 (AST) Received: from fatchubby (cpe-071-070-134-248.nc.res.rr.com [71.70.134.248]) by plain.rackshack.net (8.12.10/8.12.5) with SMTP id k0HMKO3x012136; Tue, 17 Jan 2006 17:20:24 -0500 From: J@Planeti.Biz Message-ID: <05d801c61bb5$6c8824d0$681e140a@fatchubby> To: , References: <05c301c61bb1$d88c6a00$681e140a@fatchubby> <200601171425.38772.josh@agliodbs.com> Subject: Re: Multiple Order By Criteria Date: Tue, 17 Jan 2006 17:29:04 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.255 required=5 tests=[AWL=-0.464, BIZ_TLD=1.169, NO_REAL_NAME=0.55] X-Spam-Score: 1.255 X-Spam-Level: * X-Archive-Number: 200601/270 X-Sequence-Number: 16748 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" To: Cc: 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@postgresql.org so that your > message can get through to the mailing list cleanly >