From: Scott Marlowe <scott.marlowe@gmail.com>
To: bijayant4u@yahoo.com
Cc: tv@fuzzy.cz
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgresql is very slow
Date: Tue, 24 Jun 2008 01:51:54 -0600
Message-ID: <dcc563d10806240051k23647056j36388305e1a977e1@mail.gmail.com> (raw)
In-Reply-To: <569091.76971.qm@web32704.mail.mud.yahoo.com>
References: <20229.217.77.161.17.1214229014.squirrel@sq.gransy.com>
<569091.76971.qm@web32704.mail.mud.yahoo.com>
On Mon, Jun 23, 2008 at 11:48 PM, bijayant kumar <bijayant4u@yahoo.com> wrote:
OK, you don't have a ton of updates each day, but they add up over time.
> I was not aware of the VACUUM functionality earlier, but some times back i read and run this on the server but i did not achieve anything in terms of performance. The server is running from 1 to 1.5 years and we have done VACUUM only once.
vacuuming isn't so much about performance as about maintenance. You
don't change the oil in your car to make it go faster, you do it to
keep it running smoothly. Don't change it for 1.5 years and you could
have problems. sludge build up / dead tuple build up. Kinda similar.
> Is this the problem of slow database? One more thing if i recreate the database, will it help?
Most likely. What does
vacuum verbose;
on the main database say?
> The output of ANALYZE
>
> ANALYZE verbose USERS;
> INFO: analyzing "public.USERS"
> INFO: "USERS": scanned 3000 of 54063 pages, containing 128 live rows and 1 dead rows; 128 rows in sample, 2307 estimated total rows
> ANALYZE
So, 54963 pages hold 128 live database rows. A page is 8k. that
means you're storing 128 live rows in approximately a 400+ megabyte
file.
> The output of EXPLAIN query;
>
> select * from USERS where email like '%bijayant.kumar%';
> This simplest query tooks 10 minutes and server loads goes from 0.35 to 16.94.
>
> EXPLAIN select * from USERS where email like '%bijayant.kumar%';
> QUERY PLAN
> --------------------------------------------------------------
> Seq Scan on USERS (cost=0.00..54091.84 rows=1 width=161)
> Filter: ((email)::text ~~ '%bijayant.kumar%'::text)
> (2 rows)
You're scanning ~ 54094 sequential pages to retrieve 1 row. Note
that explain analyze is generally a better choice, it gives more data
useful for troubleshooting.
Definitely need a vacuum full on this table, likely followed by a reindex.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: scott.marlowe@gmail.com, bijayant4u@yahoo.com, tv@fuzzy.cz
Subject: Re: Postgresql is very slow
In-Reply-To: <dcc563d10806240051k23647056j36388305e1a977e1@mail.gmail.com>
References: <20229.217.77.161.17.1214229014.squirrel@sq.gransy.com> <569091.76971.qm@web32704.mail.mud.yahoo.com> <dcc563d10806240051k23647056j36388305e1a977e1@mail.gmail.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