Re: Query plan changes after pg_dump / pg_restore

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jona <jonanews(at)oismail(dot)com>
Cc: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Query plan changes after pg_dump / pg_restore
Date: 2005-06-09 14:54:58
Message-ID: 11770.1118328898@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jona <jonanews(at)oismail(dot)com> writes:
> What worries me is that the plan is different,

Given that the estimated costs are close to the same, this is probably
just the result of small differences in the ANALYZE statistics leading
to small differences in cost estimates and thus choice of different
plans. I'll bet if you re-ANALYZE a few times on the source database
you'll see it flipping between plan choices too. This is normal because
ANALYZE takes a random sample of rows rather than being exhaustive.

So the interesting question is not "why are the plan choices different"
it is "how do I get the cost estimates closer to reality". That's the
only way in the long run to ensure the planner makes the right choice.
Increasing the statistics targets or fooling with planner cost
parameters are the basic tools you have available here.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2005-06-09 14:55:35 Re: Recommendations for configuring a 200 GB
Previous Message Jona 2005-06-09 13:42:24 Re: Query plan changes after pg_dump / pg_restore