Re: pg_reorg in core?
Hitoshi Harada <umi.tanuki@gmail.com>
From: Hitoshi Harada <umi.tanuki@gmail.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2012-09-21T04:00:47Z
Lists: pgsql-hackers
On Thu, Sep 20, 2012 at 7:05 PM, Michael Paquier <michael.paquier@gmail.com> wrote: > Hi all, > > During the last PGCon, I heard that some community members would be > interested in having pg_reorg directly in core. > Just to recall, pg_reorg is a functionality developped by NTT that allows to > redistribute a table without taking locks on it. > The technique it uses to reorganize the table is to create a temporary copy > of the table to be redistributed with a CREATE TABLE AS > whose definition changes if table is redistributed with a VACUUM FULL or > CLUSTER. > Then it follows this mechanism: > - triggers are created to redirect all the DMLs that occur on the table to > an intermediate log table. > - creation of indexes on the temporary table based on what the user wishes > - Apply the logs registered during the index creation > - Swap the names of freshly created table and old table > - Drop the useless objects > I'm not familiar with pg_reorg, but I wonder why we need a separate program for this task. I know pg_reorg is ok as an external program per se, but if we could optimize CLUSTER (or VACUUM which I'm a little pessimistic about) in the same way, it's much nicer than having additional binary + extension. Isn't it possible to do the same thing above within the CLUSTER command? Maybe CLUSTER .. CONCURRENTLY? Thanks, -- Hitoshi Harada