Re: Dump all the indexes/constraints/roles

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Dump all the indexes/constraints/roles
Date: 2016-10-18 16:09:35
Message-ID: CAMkU=1yd9KyVEOKnUBduLAQTeHVyvJ+7MgG40i5qD1E9YiD0FQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 17, 2016 at 8:32 PM, Patrick B <patrickbakerbr(at)gmail(dot)com> wrote:

> Hi guys,
>
> I need to export an entire database to another server, for testing purpose.
>
> Is there any way to export all indexes and constraints ?
> Postgres 9.2
> Patrick
>

By default pg_dump will export the constraints. It will export the
definition of the indexes, but not the physical contents of them, so they
have to be recreated upon import. That can be slow depending on the sizes
and types involved.

Or you can clone the whole thing with pg_basebackup. (If you have multiple
databases on the same cluster, this will take all of them. The only thing
you can do about that is drop the ones you don't want.)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2016-10-18 16:44:14 Re: tablesample performance
Previous Message Pavel Stehule 2016-10-18 15:47:15 Re: Generic way to test input arguments