Re: 2 machines, same database, same query, 10 times slower? - Mailing list pgsql-general

From Antonio Goméz Soto
Subject Re: 2 machines, same database, same query, 10 times slower?
Date
Msg-id 4FAAD89F.1030604@gmail.com
Whole thread Raw
In response to Re: 2 machines, same database, same query, 10 times slower?  (Tomas Vondra <tv@fuzzy.cz>)
Responses Re: 2 machines, same database, same query, 10 times slower?
List pgsql-general
Tomas,

running vacuum full cdr brought down the query time to 4 seconds..

Thanks a lot,
Antonio


Op 08-05-12 21:15, Tomas Vondra schreef:
> On 8.5.2012 20:32, Antonio Goméz Soto wrote:
>>>> Do this on both machines to verify that
>>>>
>>>>    SELECT relpages, reltuples FROM pg_class WHERE relname = 'cdr';
>> Slow machine:
>>
>>  relpages | reltuples
>> ----------+-----------
>>    400566 |    982321
>>
>> Fast machine:
>>
>>  relpages |  reltuples
>> ----------+-------------
>>     62076 | 1.48375e+06
>>
>>
>
> Yup, that's probably the culprit. The slow machine has to read 400000
> pages while the fast one just 62000. Each page is 8kB, so this is 3GB
> vs. 500MB difference.
>
> T.
>


pgsql-general by date:

Previous
From: Chris Hanks
Date:
Subject: Retrieving multiple columns from a subquery
Next
From: Tomas Vondra
Date:
Subject: Re: 2 machines, same database, same query, 10 times slower?