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. > -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general