From: Marcos Garcia <marcos-p-garcia@ptinovacao.pt>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Postgres performance slowly gets worse over a month
Date: 30 Jul 2002 20:49:59 +0100
Message-ID: <1028058599.21225.86.camel@sargao> (raw)
In-Reply-To: <1027556279.17709.48.camel@sargao>
References: <1027556279.17709.48.camel@sargao>
My apologies, to all that told me that the reindex was the solution to
prevent the grouth of the database.
I had a script that i thought that would reindex my database, but wasn't
true.
I figure out ,that the grouth of my database was due to the indexes with
the following sql command:
dbname=# select relname, relpages,reltuples from pg_class order by
relpages desc limit 50;
relname | relpages | reltuples
---------------------------------+----------+-----------
sms_recv_unique_idclimsgidclien | 55800 | 39259
sms_recv_pkey | 39810 | 38948
sms_send_pkey | 22828 | 52048
The relpages * 8 Kbytes, gives =~ the disk space used by the
index/table (correct me if i'm wrong). As we can see from the query
result the disk space used by the indexes is very high.
After doing the reindex of the tables, that values droped down, as well
as the space used by the database.
Query result after reindex:
dbname=# select relname, relpages,reltuples from pg_class order by
relpages desc limit 50;
relname | relpages | reltuples
---------------------------------+----------+-----------
sms_recv_unique_idclimsgidclien | 222 | 40581
sms_recv_pkey | 174 | 40581
sms_send_pkey | 430 | 54004
As a conclusion, in databases with high turn-around the use of reindex
is imperative, combined with vacuums.
Thanks to all,
M.P.Garcia
---------------------------------------------------------------------
Do not forget to reindex the db after the delete, index's do not
manage them selves(if I remember correctly). The index will continue
to grow until it eats your file system, as it did with me.
By Marc Spitzer
---------------------------------------------------------------------
On Thu, 2002-07-25 at 01:17, Marcos Garcia wrote:
> Since this conversation had started, the presented solutions for the
> disk space (disk space of tables and indexes) problem were:
>
> - reindex -> no space recovered
>
> - frequent vacuums -> some space recovered, meanwhile the database
> keeps growing
>
> - vacuumm full -> some space recovered, meanwhile the database keeps
> growing, quite similar to simple vacuum. we have also to keep in mind,
> that the option "full", makes locks to the tables. Therefore, the
> services around the database locks too, and with the growing of the
> database the time spent for "vacumm full" increases, as well as the
> downtime of the services around the database.
>
>
> So, my doubts are:
>
> - There's nothing we can do to avoid the growth of the database, only
> slow down that growth.
>
> - We, application developers that use postgresql databases have to
> count with this problem.
>
> Sorry if i'm being a little rude, but i'm in a real trouble.
>
> Thanks in advance,
>
>
> M.P.Garcia
> `
> end
--
M.P.Garcia
PT Inovação, SA
Serviços e Redes Móveis
Rua José Ferreira Pinto Basto - 3810 Aveiro
Tel: 234 403 253 - Fax: 234 424 160
E-mail: marcos-p-garcia@ptinovacao.pt
Attachments:
signature.asc (application/pgp-signature, 231B) download
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-admin@postgresql.org
Cc: marcos-p-garcia@ptinovacao.pt
Subject: Re: Postgres performance slowly gets worse over a month
In-Reply-To: <1028058599.21225.86.camel@sargao>
References: <1027556279.17709.48.camel@sargao> <1028058599.21225.86.camel@sargao>
* 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