From: PFC <lists@peufeu.com>
To: bijayant4u@yahoo.com
To: pgsql-performance@postgresql.org
Subject: Re: Postgresql is very slow
Date: Tue, 24 Jun 2008 13:25:45 +0200
Message-ID: <op.uc83c7m2cigqcu@apollo13.peufeu.com> (raw)
In-Reply-To: <473587.97248.qm@web32701.mail.mud.yahoo.com>
References: <473587.97248.qm@web32701.mail.mud.yahoo.com>
> SELECT relpages, reltuples FROM pg_class WHERE relname ='users';
> relpages | reltuples
> ----------+-----------
> 54063 | 2307
> (1 row)
This is a horribly bloated table.
> The Output of query on the old server which is fast
>
> relpages | reltuples
> ----------+-----------
> 42 | 1637
This is a healthy table.
You need to clean up the users table.
For this the easiest way is either to VACUUM FULL or CLUSTER it. CLUSTER
will be faster in your case. Use whatever index makes sense, or even the
PK.
> The Slow server load increases whenever i run a simple query, is it the
> good idea to run VACUUM full on the live server's database now or it
> should be run when the traffic is very low may be in weekend.
Use CLUSTER.
It is blocking so your traffic will suffer during the operation, which
should not take very long. Since you have very few rows, most of the
needed time will be reading the table from disk. I would suggest to do it
right now.
CLUSTER users_pk ON users;
Then, configure your autovacuum so it runs often enough. On a small table
like this (once cleaned up) VACUUM will be very fast, 42 pages should take
just a couple tens of ms to vacuum, so you can do it often.
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: lists@peufeu.com, bijayant4u@yahoo.com
Subject: Re: Postgresql is very slow
In-Reply-To: <op.uc83c7m2cigqcu@apollo13.peufeu.com>
* 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