Re: pg_restore man page question

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_restore man page question
Date: 2016-03-07 18:03:39
Message-ID: CAKFQuwZLGKE3Q2fn9t8Dded2WJK20T37A4YHHXJSBgyoUdv2hQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 7, 2016 at 10:17 AM, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
wrote:

> The man page of pg_restore says
>
> --disable-triggers
> This option is relevant only when performing a
> data-only restore. It instructs pg_restore to execute
> commands to temporarily disable triggers on the
> target tables while the data is reloaded. [...]
>
> This hint seems overly narrow: when doing a restore of schema
> PLUS data (IOW, not a schema-only restore) it should apply,
> too, shouldn't it ?
>
> Otherwise it would suggest that pg_restore does this:
>
> - restore basic table structure
> - restore data
> - restore constraints and triggers and ...
>

... ​indexes​

​Why is the surprising? When restoring everything it is able to "cheat"
since it knows that what it is restoring is a self-consistent state of
being and as such there is no need or desire to fire triggers, check
constraints, or maintain indexes, as the data is being loaded. I'm not
positive on the exact mechanics but observation and Josh's comment
cross-thread support this explanation.

It can be readily checked by passing the --list option to pg_restore.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2016-03-07 18:22:09 Re: pg_restore man page question
Previous Message Geoff Winkless 2016-03-07 17:35:04 Re: index problems (again)