On Mon, Oct 17, 2016 at 8:32 PM, Patrick B <patrickbake...@gmail.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
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.)