Re: Concurrently option for reindexdb

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Concurrently option for reindexdb
Date: 2014-08-25 18:48:09
Message-ID: CAHGQGwHBfGRnk88OSdHksHiuehm5AvnMT_cCU3mV+BF+RBVDZg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 25, 2014 at 4:33 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Mon, Aug 25, 2014 at 3:48 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> On Mon, Aug 25, 2014 at 3:36 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
>>> Attached WIP patch adds "-C (--concurrently)" option for reindexdb
>>> command for concurrently reindexing.
>>> If we specify "-C" option with any table then reindexdb do reindexing
>>> concurrently with minimum lock necessary.
>>> Note that we cannot use '-s' option (for system catalog) and '-C'
>>> option at the same time.
>>> This patch use simple method as follows.
>>>
>>> 1. Do "CREATE INDEX CONCURRENTLY" new index which has same definition
>>> as target index
>>> 2. Aquire ACCESS EXCLUSIVE LOCK to target table( and transaction starts)
>>> 3. Swap old and new index
>>> 4. Drop old index
>>> 5. COMMIT
>>>
>>> These process are based on pg_repack(or pg_reorg) does, done via SQL.

+1. I have some shell scripts which do that reindex technique,
and I'd be happy if I can replace them with this feature.

Can this technique reindex the primary key index and the index
which other objects depend on (e.g., foreign key)?

>> This would be a useful for users, but I am not sure that you can call
>> that --concurrently as the rename/swap phase requires an exclusive
>> lock, and you would actually block a real implementation of REINDEX
>> CONCURRENTLY (hm...).
>>
>
> this might be difficult to call this as --concurrently.
> It might need to be change the name.

I'm OK to say that as --concurrently if the document clearly
explains that restriction. Or --almost-concurrently? ;P

>>> ToDo
>>> - Multi language support for log message.
>> Why? I am not sure that's something you should deal with.
>
> The log message which has been existed already are supported multi
> language support using by .po file,
> But newly added message has not corresponded message in .po file, I thought.

I don't think that you need to add the update of .po file into
the feature patch.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-08-25 18:48:20 Re: Verbose output of pg_dump not show schema name
Previous Message Fabrízio de Royes Mello 2014-08-25 18:47:10 Re: [GSoC2014] Patch ALTER TABLE ... SET LOGGED