delete/recreate indexes

From: alan <alan(dot)miller3(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: delete/recreate indexes
Date: 2011-10-19 15:03:48
Message-ID: 727c5bc3-0bab-490f-add7-6eed47627ee5@ff5g2000vbb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi

I'm a postgres novice so ....

I have this fairly simple table
-------------------------------------------------
device integer not null,
group integer not null,
datum timestamp without time zone not null,
val1 numeric(7,4) not null default 0.000,
val2 numeric(7,4) not null default 0.000
-------------------------------------------------

The device column is a foreign-key to the PK of my device table.
and I have a UNIQUE INDEX on 3 columns device, group, datum

This is just a test database and I want to keep the "datum" values
(timestamps that span approx 1 month) all bound to CURRENT_DATE().

So I thought I’d just run this once (via cron) every morning.
BEGIN;
DROP INDEX data_unique;
UPDATE data SET datum = (data.datum + interval '24 hours');
CREATE UNIQUE INDEX data_unique ON public.data USING BTREE
(device, group, datum);
COMMIT;

But
1. it’s taking forever and
2. I’m seeing that my disk is filling up real fast.

Any suggestions?

Alan

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2011-10-19 15:13:42 Re: How many Cluster database on a single server
Previous Message d.davolio@mastertraining.it 2011-10-19 15:02:54 Re: How many Cluster database on a single server