pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Hilbert, Karin <ioh1@psu.edu>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Manage PostgreSQL Database for GITLAB Application?
Date: Mon, 21 Jan 2019 18:32:06 -0500
Message-ID: <20190121233206.GB2528@tamriel.snowman.net> (raw)
In-Reply-To: <DM6PR02MB48764D125E9A4743EFFB40CD899F0@DM6PR02MB4876.namprd02.prod.outlook.com>
References: <DM6PR02MB4876CBD53ECBC0D2A12A6DF9899F0@DM6PR02MB4876.namprd02.prod.outlook.com>
	<20190121185300.GZ2528@tamriel.snowman.net>
	<DM6PR02MB48764D125E9A4743EFFB40CD899F0@DM6PR02MB4876.namprd02.prod.outlook.com>

Greetings,

* Hilbert, Karin (ioh1@psu.edu) wrote:
> The other year, we had to restore the prod database backup to dev & that changed the schema name.  I was thinking that it would be better have the same names used for dev & prod so that restores from one environment to another would be easier.  (That's a standard that our DBA team employs for our SQL Server databases.)  Does it make sense to also employ that standard for PostgreSQL databases?  Is there any reason to keep the names different between the environments?

When possible, the approach that I tend to use here is to incorporate
the testing of backups into the dev/staging restore cycle.  That is,
I'll do a backup of prod and then restore that into dev (and/or staging,
as appropriate) on a regular basis.  Using pgbackrest's delta restore
option, that can be done rather quickly, even for quite large databases.

If you want to change the schema/user names, that can be done in a
post-restore script that's run (along with any data-cleaning processes
and such, if appropriate).  For further checking, you can also pg_dump
the result and then pg_restore into a new/clean database, which will
also verify your constraints and such too.

As for if you should change schema/user...  that really depends on the
specifics of your environment.  Having the usernames be different can be
good as it adds an additional level of seperation between dev and prod
(so that a dev system wouldn't be able to mistakenly log into a prod
system or similar...), but it also means that dev and prod don't act
exactly the same, and you likely have other measures in place to reduce
the risk of dev talking to prod.

Thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (9+ messages)  latest in thread

Message-ID: <20190121233206.GB2528@tamriel.snowman.net>
Permalink:  ../20190121233206.GB2528@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20190121233206.GB2528@tamriel.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: sfrost@snowman.net, ioh1@psu.edu
  Subject: Re: Manage PostgreSQL Database for GITLAB Application?
  In-Reply-To: <20190121233206.GB2528@tamriel.snowman.net>
  References: <DM6PR02MB4876CBD53ECBC0D2A12A6DF9899F0@DM6PR02MB4876.namprd02.prod.outlook.com> <20190121185300.GZ2528@tamriel.snowman.net> <DM6PR02MB48764D125E9A4743EFFB40CD899F0@DM6PR02MB4876.namprd02.prod.outlook.com> <20190121233206.GB2528@tamriel.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox