pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jona <jonanews@oismail.com>
Cc: Dennis Bjorklund <db@zigo.dhs.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query plan changes after pg_dump / pg_restore
Date: Thu, 09 Jun 2005 10:54:58 -0400
Message-ID: <11770.1118328898@sss.pgh.pa.us> (raw)
In-Reply-To: <42A7F9D9.8000004@oismail.com>
References: <Pine.LNX.4.44.0506090918100.25939-100000@zigo.dhs.org>
	<42A7F9D9.8000004@oismail.com>

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



view thread (11+ messages)  latest in thread

Message-ID: <11770.1118328898@sss.pgh.pa.us>
Permalink:  ../11770.1118328898@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11770.1118328898@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, jonanews@oismail.com, db@zigo.dhs.org
  Subject: Re: Query plan changes after pg_dump / pg_restore
  In-Reply-To: <11770.1118328898@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