Skip site navigation (1) Skip section navigation (2)

Re: Postgresql is very slow

From: PFC <lists(at)peufeu(dot)com>
To: bijayant4u(at)yahoo(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Postgresql is very slow
Date: 2008-06-24 11:25:45
Message-ID: op.uc83c7m2cigqcu@apollo13.peufeu.com (view raw or flat)
Thread:
Lists: pgsql-performance
> 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.





In response to

Responses

pgsql-performance by date

Next:From: bijayant kumarDate: 2008-06-24 12:12:53
Subject: Re: Postgresql is very slow
Previous:From: tvDate: 2008-06-24 10:02:08
Subject: Re: Postgresql is very slow

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group