Re: Identical DB's, different execution plans

Поиск
Список
Период
Сортировка
От Doug Eck
Тема Re: Identical DB's, different execution plans
Дата
Msg-id 650568.58055.qm@web45201.mail.sp1.yahoo.com
обсуждение исходный текст
Ответ на Identical DB's, different execution plans  (Doug Eck <deck1@yahoo.com>)
Список pgsql-performance
Tom,

You nailed it.  The t1 table was using 9600 relpages versus 410 after the vacuum full.  The two databases are now showing similar execution plans and times.

Thanks for your help.  It is greatly appreciated.

Doug Eck

----- Original Message ----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Doug Eck <deck1@yahoo.com>
Cc: pgsql-performance@postgresql.org
Sent: Monday, September 29, 2008 6:20:20 PM
Subject: Re: [PERFORM] Identical DB's, different execution plans

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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Identical DB's, different execution plans
Следующее
От: "Gauri Kanekar"
Дата:
Сообщение: Confusing Query Performance