Re: Query plan changes after pg_dump / pg_restore - Mailing list pgsql-performance

From Tom Lane
Subject Re: Query plan changes after pg_dump / pg_restore
Date
Msg-id 11770.1118328898@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query plan changes after pg_dump / pg_restore  (Jona <jonanews@oismail.com>)
Responses Re: Query plan changes after pg_dump / pg_restore
List pgsql-performance
Jona <jonanews@oismail.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

pgsql-performance by date:

Previous
From: Jona
Date:
Subject: Re: Query plan changes after pg_dump / pg_restore
Next
From: "Kevin Grittner"
Date:
Subject: Re: Recommendations for configuring a 200 GB