pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Scott Marlowe <smarlowe@g2switchworks.com>
Cc: Steve <cheetah@tanabi.org>
Cc: PostgreSQL Performance <pgsql-performance@postgresql.org>
Subject: Re: Strangely Variable Query Performance
Date: Thu, 12 Apr 2007 19:00:09 -0400
Message-ID: <9833.1176418809@sss.pgh.pa.us> (raw)
In-Reply-To: <1176416077.13754.26.camel@state.g2switchworks.com>
References: <57271CC2-BCB1-4ACA-A177-4FF64F1BC33F@brandeis.edu>
	<E1HbzJr-0005VG-GC@elasmtp-curtail.atl.sa.earthlink.net>
	<16E9A17C-ADFA-43B2-B7EA-5C7A4D7E96D1@event-s.net>
	<E1Hc0lc-0001iE-La@elasmtp-banded.atl.sa.earthlink.net>
	<0914C05F-BA1B-4A6C-A1B1-52256BC851A4@event-s.net>
	<1176396964.13754.16.camel@state.g2switchworks.com>
	<Pine.LNX.4.64.0704121000570.32187@glacier.frostconsultingllc.com>
	<Pine.GSO.4.64.0704121653030.17955@kittyhawk.tanabi.org>
	<1176414724.13754.23.camel@state.g2switchworks.com>
	<Pine.GSO.4.64.0704121804000.17955@kittyhawk.tanabi.org>
	<1176416077.13754.26.camel@state.g2switchworks.com>

Scott Marlowe <smarlowe@g2switchworks.com> writes:
> So there's a misjudgment of the number of rows returned by a factor of
> about 88.  That's pretty big.  Since you had the same number without the
> receipt date (I think...) then it's the encounter_id that's not being
> counted right.

I don't think that's Steve's problem, though.  It's certainly
misestimating, but nonetheless the cost estimate for the seqscan is
1902749.83 versus 14819.81 for the bitmap scan; it should've picked
the bitmap scan anyway.

I tried to duplicate the problem here, without any success; I get

Bitmap Heap Scan on detail_summary ds  (cost=422.01..801.27 rows=100 width=4)
   Recheck Cond: (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[]))
   Filter: (receipt >= '1998-12-30'::date)
   ->  Bitmap Index Scan on detail_summary_encounter_id_idx  (cost=0.00..421.98 rows=100 width=0)
         Index Cond: (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[]))

so either this has been fixed by a post-8.2.3 bug fix (which I doubt,
it doesn't seem familiar at all) or there's some additional contributing
factor.  Steve, are you using any nondefault planner parameters?

			regards, tom lane



view thread (29+ messages)  latest in thread

Message-ID: <9833.1176418809@sss.pgh.pa.us>
Permalink:  ../9833.1176418809@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9833.1176418809@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, smarlowe@g2switchworks.com, cheetah@tanabi.org
  Subject: Re: Strangely Variable Query Performance
  In-Reply-To: <9833.1176418809@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox