Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glj36-0003Ui-Ub for pgsql-general@arkaria.postgresql.org; Mon, 21 Jan 2019 23:32:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1glj35-0006Jm-Ho for pgsql-general@arkaria.postgresql.org; Mon, 21 Jan 2019 23:32:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1glj35-0006Jf-9T for pgsql-general@lists.postgresql.org; Mon, 21 Jan 2019 23:32:11 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1glj32-00016m-PU for pgsql-general@lists.postgresql.org; Mon, 21 Jan 2019 23:32:10 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id C95525F79E; Mon, 21 Jan 2019 18:32:06 -0500 (EST) Date: Mon, 21 Jan 2019 18:32:06 -0500 From: Stephen Frost To: "Hilbert, Karin" Cc: "pgsql-general@lists.postgresql.org" Subject: Re: Manage PostgreSQL Database for GITLAB Application? Message-ID: <20190121233206.GB2528@tamriel.snowman.net> References: <20190121185300.GZ2528@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="q9rr6YB0F2YEovFO" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --q9rr6YB0F2YEovFO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --q9rr6YB0F2YEovFO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJcRlZ2AAoJEO1sijiDR2RVVd0QAI1NhDrm1bR2JcBqn6QEk7OY 7TD/R7koA3lJ/eFES4YTUZ9ABxWG82GWo8lFqERQlI/OP7ytKtCB9/BlYQY3oc6b bdSmwrixokvXFBV9zMDbvUTN06D/K/2tkizoJ7hUWTMY/mUEfNhhhL9xu1q2a7CN NGUoS8Q1S5KCx9Akk1zW4eto0ODdDPWdZ+1zWDiq7XP/b10t9mEVQ4HABIxV+/RL 1XTjfft1DcbZwBILWPmcTczN/WEzP8cNc7D8NjrsfMJeOTvjYQb6El5FQ5JA0Xk1 3uxStQyqR1UMKAE7iaJp+BTkzH7N+GOtKip5l2Rn0sDB3Wg2c2wMlRmVuqs4OpH1 NL4jf7d4ERWm1Ktz970qMz8Fna1nccHMuyvmAQyh3wQo056hl5FOITh1+Yb8i1oL YPgsOT8IGTKe5Qjx3k+bItdawFkGuXGtYqnWr/t4bHp6JfD6ilj2P9d5688R0B+W tuSqji+nY8EbYiJwDRA9jSAwQxpuDmUnOelf/Am7dlw25TVj6XBIFMYFJSiwstlN XRybVFwdvs5vwGSl3sBEyp3mZl5xPfpx4wpjwVV2JBKrKCpJGo6JVpFCUD8xjCaj XJFWK0hU1BPXeURoeh4lidDewc0GlYhQUBme4djTLAzlA8GP4UotBrI8t2hS5jMq 81m6+ZjSa8n0iNsUEP+2 =Ii5W -----END PGP SIGNATURE----- --q9rr6YB0F2YEovFO--