Re: Strangely Variable Query Performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steve <cheetah@xxxxxxxxxx> writes:
> With enable_seqscan=off I get:

>     ->  Bitmap Index Scan on detail_summary_receipt_encounter_idx 
> (cost=0.00..4211395.17 rows=1099 width=0)
>           Index Cond: ((receipt >= '1998-12-30'::date) AND (encounter_id = 
> ANY ...

> The explain analyze is pending, running it now (however it doens't really 
> appear to be any faster using this plan).

Yeah, that index is nearly useless for this query --- since the receipt
condition isn't really eliminating anything, it'll have to look at every
index entry :-( ... in fact, do so again for each of the IN arms :-( :-(
So it's definitely right not to want to use that plan.  Question is, why
is it seemingly failing to consider the "right" index?

I'm busy setting up my test case on an x86_64 machine right now, but
I rather fear it'll still work just fine for me.  Have you got any
nondefault parameter settings besides the ones you already mentioned?

Another thing that might be interesting, if you haven't got a problem
with exclusive-locking the table for a little bit, is

	BEGIN;
	DROP INDEX each index except detail_summary_encounter_id_idx
	EXPLAIN the problem query
	ROLLBACK;

just to see if it does the right thing when it's not distracted by
all the "wrong" indexes (yeah, I'm grasping at straws here).  If you
set up the above as a SQL script it should only take a second to run.
Please try this with both settings of enable_seqscan --- you don't need
to do "explain analyze" though, we just want to know which plan it picks
and what the cost estimate is.

			regards, tom lane


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux