Re: Teaching pg_dump to use NOT VALID constraints

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Teaching pg_dump to use NOT VALID constraints
Date: 2014-11-10 17:33:47
Message-ID: 20141110173347.GC1791@alvin.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:
> Magnus and I discussed the need for pg_dump to offer the use of NOT
> VALID constraints.
> Here's the patch.
>
>
> pg_dump --no-revalidaton
>
> will add "NOT VALID" onto the recreation SQL for any FKs, but only for
> ones that were already known to be valid.

Well. Constraints that haven't been validated already have a NOT VALID
emitted by ruleutils.c, yes? So what this patch does is add such a
clause for all *other* constraints. Right? In other words what it aims
to do is speed up loading of data by skipping the validation step on
restore. Is that right?

ISTM we could have the default pg_dump behavior emit NOT VALID
constraints, and add VALIDATE CONSTRAINT commands at the end; that way
the database is usable sooner but the constraints end up marked as
validated by the time the dump is finished.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2014-11-10 17:43:50 Re: remove pg_standby?
Previous Message Fujii Masao 2014-11-10 17:31:57 Re: PENDING_LIST_CLEANUP_SIZE - maximum size of GIN pending list Re: HEAD seems to generate larger WAL regarding GIN index