delete/recreate indexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux