Re: pg_reorg in core?

From: Satoshi Nagayasu <snaga(at)uptime(dot)jp>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_reorg in core?
Date: 2012-09-24 18:38:13
Message-ID: 5060A895.2070405@uptime.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/09/25 0:15, Simon Riggs wrote:
> On 21 September 2012 08:42, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>>
>>
>> On Fri, Sep 21, 2012 at 1:00 PM, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
>> wrote:
>>>
>>> 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?
>>
>> CLUSTER might be more adapted in this case as the purpose is to reorder the
>> table.
>> The same technique used by pg_reorg (aka table coupled with triggers) could
>> lower the lock access of the table.
>> Also, it could be possible to control each sub-operation in the same fashion
>> way as CREATE INDEX CONCURRENTLY.
>> By the way, whatever the operation, VACUUM or CLUSTER used, I got a couple
>> of doubts:
>> 1) isn't it be too costly for a core operation as pg_reorg really needs many
>> temporary objects? Could be possible to reduce the number of objects created
>> if added to core though...
>> 2) Do you think the current CLUSTER is enough and are there wishes to
>> implement such an optimization directly in core?
>
>
> For me, the Postgres user interface should include
> * REINDEX CONCURRENTLY
> * CLUSTER CONCURRENTLY
> * ALTER TABLE CONCURRENTLY
> and also that autovacuum would be expanded to include REINDEX and
> CLUSTER, renaming it to automaint.
>
> The actual implementation mechanism for those probably looks something
> like pg_reorg, but I don't see it as preferable to include the utility
> directly into core, though potentially some of the underlying code
> might be.

I think it depends on what trade-off we can see.

AFAIK, basically, rebuilding tables and/or indexes has
a trade-off between "lock-free" and "disk-space".

So, if we have enough disk space to build a "temporary"
table/index when rebuilding a table/index, "concurrently"
would be a great option, and I would love it to have
in core.

Regards,
--
Satoshi Nagayasu <snaga(at)uptime(dot)jp>
Uptime Technologies, LLC. http://www.uptime.jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-09-24 18:51:59 Re: [ADMIN] pg_upgrade from 9.1.3 to 9.2 failed
Previous Message Satoshi Nagayasu 2012-09-24 18:29:25 Re: [PoC] load balancing in libpq