Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5D9F0650E87 for ; Tue, 24 Jun 2008 09:15:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 97377-05 for ; Tue, 24 Jun 2008 09:15:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 30.mail-out.ovh.net (30.mail-out.ovh.net [213.186.62.213]) by postgresql.org (Postfix) with SMTP id 1E5A8650E23 for ; Tue, 24 Jun 2008 09:15:15 -0300 (ADT) Received: (qmail 3339 invoked by uid 503); 24 Jun 2008 11:17:24 -0000 Received: from b7.ovh.net (HELO mail181.ha.ovh.net) (213.186.33.57) by 30.mail-out.ovh.net with SMTP; 24 Jun 2008 11:17:24 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 24 Jun 2008 11:16:58 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13.peufeu.com) (88.161.102.87) by ns0.ovh.net with SMTP; 24 Jun 2008 11:16:56 -0000 Date: Tue, 24 Jun 2008 13:25:45 +0200 To: bijayant4u@yahoo.com, pgsql-performance@postgresql.org Subject: Re: Postgresql is very slow From: PFC Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: <473587.97248.qm@web32701.mail.mud.yahoo.com> Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: <473587.97248.qm@web32701.mail.mud.yahoo.com> User-Agent: Opera Mail/9.24 (Linux) X-Ovh-Tracer-Id: 15539670514984224457 X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.63 tagged_above=0 required=5 tests=AWL=0.630 X-Spam-Level: X-Archive-Number: 200806/117 X-Sequence-Number: 30467 > SELECT relpages, reltuples FROM pg_class WHERE relname =3D'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. CLUSTE= R = 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 th= e = > 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 i= t = right now. CLUSTER users_pk ON users; Then, configure your autovacuum so it runs often enough. On a small tab= le = like this (once cleaned up) VACUUM will be very fast, 42 pages should ta= ke = just a couple tens of ms to vacuum, so you can do it often.