Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 665B59FB9A2 for ; Thu, 12 Apr 2007 20:50:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 62922-10 for ; Thu, 12 Apr 2007 20:50:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from kittyhawk.tanabi.org (nc-67-76-229-82.sta.embarqhsd.net [67.76.229.82]) by postgresql.org (Postfix) with ESMTP id 30D919FB794 for ; Thu, 12 Apr 2007 20:50:34 -0300 (ADT) Received: from kittyhawk.tanabi.org (localhost [127.0.0.1]) by kittyhawk.tanabi.org (8.13.8/8.13.8) with ESMTP id l3CNgnqp026612; Thu, 12 Apr 2007 19:42:49 -0400 (EDT) Received: from localhost (cheetah@localhost) by kittyhawk.tanabi.org (8.13.8/8.13.8/Submit) with ESMTP id l3CNgnsB026608; Thu, 12 Apr 2007 19:42:49 -0400 (EDT) X-Authentication-Warning: kittyhawk.tanabi.org: cheetah owned process doing -bs Date: Thu, 12 Apr 2007 19:42:49 -0400 (EDT) From: Steve To: Tom Lane cc: Scott Marlowe , PostgreSQL Performance Subject: Re: Strangely Variable Query Performance In-Reply-To: <10117.1176420763@sss.pgh.pa.us> Message-ID: References: <57271CC2-BCB1-4ACA-A177-4FF64F1BC33F@brandeis.edu> <16E9A17C-ADFA-43B2-B7EA-5C7A4D7E96D1@event-s.net> <0914C05F-BA1B-4A6C-A1B1-52256BC851A4@event-s.net> <1176396964.13754.16.camel@state.g2switchworks.com> <1176414724.13754.23.camel@state.g2switchworks.com> <1176416077.13754.26.camel@state.g2switchworks.com> <9833.1176418809@sss.pgh.pa.us> <10117.1176420763@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/280 X-Sequence-Number: 24157 Here's the explain analyze with seqscan = off: Bitmap Heap Scan on detail_summary ds (cost=4211395.20..4213045.32 rows=1099 width=4) (actual time=121288.825..121305.908 rows=112 loops=1) Recheck Cond: ((receipt >= '1998-12-30'::date) AND (encounter_id = ANY ('{8813186,8813187,8813188,8813189,8813190,8813191,8813192,8813193,8813194,8813195,8813196,8813197,8813198,8813199,8813200,8813201,8813202,8813203,8813204,8813205,8813206,8813207,8813208,8813209,8813210,8813211,8813212,8813213,8813214,8813215,8813216,8813217,8813218,8813219,8813220,8813221,8813222,8813223,8813224,8813225,8813226,8813227,8813228,8813229,8813230,8813231,8813232,8813233,8813234,8813235,8813236,8813237,8813238,8813239,8813240,8813241,8813242,8813243,8813244,8813245,8813246,8813247,8813248,8813249,8813250,8813251,8813252,8813253,8813254,8813255,8813256,8813257,8813258,8813259,8813260,8813261,8813262,8813263,8813264,8813265,8813266,8813267,8813268,8813269,8813270,8813271,8813272,8813273,8813274,8813275,8813276,8813277,8813278,8813279,8813280,8813281,8813282,8813283,8813284,8815534}'::integer[]))) -> Bitmap Index Scan on detail_summary_receipt_encounter_idx (cost=0.00..4211395.17 rows=1099 width=0) (actual time=121256.681..121256.681 rows=112 loops=1) Index Cond: ((receipt >= '1998-12-30'::date) AND (encounter_id = ANY ('{8813186,8813187,8813188,8813189,8813190,8813191,8813192,8813193,8813194,8813195,8813196,8813197,8813198,8813199,8813200,8813201,8813202,8813203,8813204,8813205,8813206,8813207,8813208,8813209,8813210,8813211,8813212,8813213,8813214,8813215,8813216,8813217,8813218,8813219,8813220,8813221,8813222,8813223,8813224,8813225,8813226,8813227,8813228,8813229,8813230,8813231,8813232,8813233,8813234,8813235,8813236,8813237,8813238,8813239,8813240,8813241,8813242,8813243,8813244,8813245,8813246,8813247,8813248,8813249,8813250,8813251,8813252,8813253,8813254,8813255,8813256,8813257,8813258,8813259,8813260,8813261,8813262,8813263,8813264,8813265,8813266,8813267,8813268,8813269,8813270,8813271,8813272,8813273,8813274,8813275,8813276,8813277,8813278,8813279,8813280,8813281,8813282,8813283,8813284,8815534}'::integer[]))) Total runtime: 121306.233 ms Your other question is answered in the other mail along with the non-analyze'd query plan :D Steve On Thu, 12 Apr 2007, Tom Lane wrote: > Steve writes: >> ... even if I force it to use the indexes >> (enable_seqscan=off) it doesn't make it any faster really :/ > > Does that change the plan, or do you still get a seqscan? > > BTW, how big is this table really (how many rows)? > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >