From: | Bill Moran <wmoran(at)collaborativefusion(dot)com> |
---|---|
To: | "Ezequias Rodrigues da Rocha" <ezequias(dot)rocha(at)gmail(dot)com> |
Cc: | "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, "Dhaval Shah" <dhaval(dot)shah(dot)m(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How often do I need to reindex tables? |
Date: | 2007-02-28 17:09:31 |
Message-ID: | 20070228120931.a77ee11a.wmoran@collaborativefusion.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In response to "Ezequias Rodrigues da Rocha" <ezequias(dot)rocha(at)gmail(dot)com>:
> 2007/2/27, Jim C. Nasby <jim(at)nasby(dot)net>:
> > On Tue, Feb 27, 2007 at 11:26:02AM -0800, Dhaval Shah wrote:
> > > I am planning to use 8.2 and the average inserts/deletes and updates
> > > across all tables is moderate. That is, it is a moderate sized
> > > database with moderate usage of tables.
> > >
> > > Given that, how often do I need to reindex the tables? Do I need to do
> > > it everyday?
> >
> > No, you should very rarely if ever need to do it.
I don't agree. I think that regular indexing is mandatory under some
workloads. Example:
bacula=# select relname, relpages from pg_class where relkind='i' and relname not like 'pg_%' order by relname;
relname | relpages
-------------------------------+----------
basefiles_pkey | 1
cdimages_pkey | 1
client_name_idx | 2
client_pkey | 2
counters_pkey | 1
device_pkey | 1
file_fp_idx | 41212
[...]
bacula=# reindex database bacula;
[...]
relname | relpages
-------------------------------+----------
basefiles_pkey | 1
cdimages_pkey | 1
client_name_idx | 2
client_pkey | 2
counters_pkey | 1
device_pkey | 1
file_fp_idx | 21367
[...]
There are some additional indexes that I've snipped from the output that also
saw some benefit from reindexing, but let's just focus on file_fp_idx.
Please note that the database you're looking at is reindexed _weekly_ by a
cron job, which means the index bloat you're seeing in the above example is
the result of normal activity since last Saturday.
I've brought this up before, and I want to point it out again. I really
think there are certain workloads that require reindexing. Luckily for
this particular workload, it's easy to schedule a job to do so, since I
know when the backups aren't running :)
--
Bill Moran
Collaborative Fusion Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2007-02-28 17:17:46 | Re: How often do I need to reindex tables? |
Previous Message | Ron Johnson | 2007-02-28 17:07:10 | Re: Difference between UNIQUE constraint vs index |