Re: order of operations for pg_restore

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andrew Hammond <andrew(dot)george(dot)hammond(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: order of operations for pg_restore
Date: 2012-01-12 02:45:29
Message-ID: 4F0E4949.9020104@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/11/2012 07:57 PM, Andrew Hammond wrote:
> I'm working on a tool that runs pg_restore with -j 4. I notice that
> after COPYing in the data, pg_restore does two indexes and a cluster
> command in parallel. The first CREATE INDEX is running, the CLUSTER
> command is waiting on it and the second CREATE INDEX is waiting on the
> CLUSTER. This seems sub-optimal. Would it make sense to run the
> CLUSTER command first? I'm pretty sure I can replicate the behavior if
> necessary. Running 9.1.2.
>

Well, we don't actually run CLUSTER. We run a command to mark a table as
clustered on the index. The nasty part is that it's not a separate TOC
member, it's in the same TOC as the index creation. But ALTER TABLE has
different locking requirements from CREATE INDEX. If the clustered index
is not one created from a constraint we could have the dependencies
wrong. It looks like this is something we all missed when parallel
restore was implemented. I think we might need to split the ALTER TABLE
... CLUSTER from its parent statement.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2012-01-12 03:09:15 Re: [COMMITTERS] pgsql: Send new protocol keepalive messages to standby servers.
Previous Message Thom Brown 2012-01-12 01:54:44 Re: measuring spinning