pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Doug Eck <deck1@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Identical DB's, different execution plans
Date: Mon, 29 Sep 2008 19:20:20 -0400
Message-ID: <25755.1222730420@sss.pgh.pa.us> (raw)
In-Reply-To: <822909.77097.qm@web45203.mail.sp1.yahoo.com>
References: <822909.77097.qm@web45203.mail.sp1.yahoo.com>

Doug Eck <deck1@yahoo.com> writes:
> The new plan from the slower db:

>    ->  Index Scan using t1_uc2 on t1  (cost=0.00..25604.74 rows=204906 width=32) (actual time=0.061..327.285 rows=8438 loops=1)
>          Filter: active

This seems a bit fishy.  In the first place, with such a simple filter
condition it shouldn't be that far off on the rowcount estimate.  In
the second place, the cost estimate is more than twice what the other
server estimates to do a seqscan and sort of the same data, and the
rowcount estimate is five times as much.  So there's something really
significantly different about the t1 tables in the two cases.

The first thing you ought to do is to look at the pg_class.relpages
and reltuples entries for t1 in both databases.  What I am suspecting is
that for some reason the "slow" db has suffered a lot of bloat in that
table, leading to a corresponding increase in the cost of a seqscan.
If so, a VACUUM FULL or CLUSTER should fix it, though you'll next need
to look into why routine vacuumings weren't happening.  (It looks like
t2 may be a bit bloated as well.)

If that's not it, we'll need to probe deeper ...

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <25755.1222730420@sss.pgh.pa.us>
Permalink:  ../25755.1222730420@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25755.1222730420@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, deck1@yahoo.com
  Subject: Re: Identical DB's, different execution plans
  In-Reply-To: <25755.1222730420@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