Re: delete/recreate indexes

From: "Bort, Paul" <pbort(at)tmwsystems(dot)com>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: delete/recreate indexes
Date: 2011-10-20 13:24:45
Message-ID: A56C12C60A05604A9DE17530524D5FE606CAE837@EXMBX1.tmwsystems.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> An unrestricted update will end up rewriting the whole table.
> It's advisable to run VACUUM afterward, so that the wasted
> space can be reclaimed. What version are you on? Do you have
> autovacuum enabled?
>
> Also, to take a step back, why do you try to keep the
> timestamps changing like that? Why not store the information
> you need in the record (e.g. insert time as well as the
> datum) and then compute the result you need using a SELECT
> (or make it a view for convenience)? Fundamentally, these
> records aren't changing, you are just trying to interpret
> them in the context of the current day. That should be done
> using a SELECT, not an UPDATE.
>

I like Jeff's idea of redefining the problem. If you need the data to contain dates in the last 30 days, you might want to consider storing an interval, then using a view that includes a calculation using CURRENT_DATE().

Regards,
Paul Bort
Systems Engineer
TMW Systems, Inc.
pbort(at)tmwsystems(dot)com
216 831 6606 x2233
216 8313606 (fax)

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2011-10-20 15:55:39 Re: Heavy contgnous load
Previous Message Craig Ringer 2011-10-20 03:44:36 Re: Heavy contgnous load