pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_upgrade as a way of cloning an instance?
5+ messages / 3 participants
[nested] [flat]

* pg_upgrade as a way of cloning an instance?
@ 2021-07-07 06:53  Luca Ferrari <fluca1978@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Luca Ferrari @ 2021-07-07 06:53 UTC (permalink / raw)
  To: pgsql-general <pgsql-general@lists.postgresql.org>

Hi all,
someone pointed me out that pg_upgrade can be used to do a clone of
the database, specifying the same binaries such as

pg_upgrade -B /usr/pgsql-13/bin -b /usr/pgsql-13/bin -D /data/clone -d /data/src

I tested it and it seems to work, even if I don't see any point in
running it (and most notably it requires a downtime on the original
cluster).
Any opinion about that?

Thanks,
Luca





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pg_upgrade as a way of cloning an instance?
@ 2021-07-07 08:22  Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  parent: Luca Ferrari <fluca1978@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2021-07-07 08:22 UTC (permalink / raw)
  To: Luca Ferrari <fluca1978@gmail.com>; pgsql-general <pgsql-general@lists.postgresql.org>

On 07.07.21 08:53, Luca Ferrari wrote:
> Hi all,
> someone pointed me out that pg_upgrade can be used to do a clone of
> the database, specifying the same binaries such as
> 
> pg_upgrade -B /usr/pgsql-13/bin -b /usr/pgsql-13/bin -D /data/clone -d /data/src
> 
> I tested it and it seems to work, even if I don't see any point in
> running it (and most notably it requires a downtime on the original
> cluster).
> Any opinion about that?

Yeah, seems pretty pointless.  You can just copy the data directory 
directly and get the same effect.  pg_upgrade basically does a data 
directory copy plus some extra stuff to convert the system catalogs 
between versions, and if you don't need that second part, you might as 
well do the first part directly.





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pg_upgrade as a way of cloning an instance?
@ 2021-07-07 08:30  Luca Ferrari <fluca1978@gmail.com>
  parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Luca Ferrari @ 2021-07-07 08:30 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>

On Wed, Jul 7, 2021 at 10:22 AM Peter Eisentraut
<peter.eisentraut@enterprisedb.com> wrote:
> Yeah, seems pretty pointless.  You can just copy the data directory
> directly and get the same effect.  pg_upgrade basically does a data
> directory copy plus some extra stuff to convert the system catalogs
> between versions, and if you don't need that second part, you might as
> well do the first part directly.


Agree on everything, but I was curious, since users sometime find ways
to do things that are almost insane!

Thanks,
Luca





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pg_upgrade as a way of cloning an instance?
@ 2021-07-08 00:30  Bruce Momjian <bruce@momjian.us>
  parent: Luca Ferrari <fluca1978@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Bruce Momjian @ 2021-07-08 00:30 UTC (permalink / raw)
  To: Luca Ferrari <fluca1978@gmail.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; pgsql-general <pgsql-general@lists.postgresql.org>

On Wed, Jul  7, 2021 at 10:30:15AM +0200, Luca Ferrari wrote:
> On Wed, Jul 7, 2021 at 10:22 AM Peter Eisentraut
> <peter.eisentraut@enterprisedb.com> wrote:
> > Yeah, seems pretty pointless.  You can just copy the data directory
> > directly and get the same effect.  pg_upgrade basically does a data
> > directory copy plus some extra stuff to convert the system catalogs
> > between versions, and if you don't need that second part, you might as
> > well do the first part directly.
> 
> 
> Agree on everything, but I was curious, since users sometime find ways
> to do things that are almost insane!

Also, pg_upgrade will throw an error if copying from one version to the
same version if there are tablespaces since the tablespace directory
name is the catalog version name.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pg_upgrade as a way of cloning an instance?
@ 2021-07-12 09:38  Luca Ferrari <fluca1978@gmail.com>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Luca Ferrari @ 2021-07-12 09:38 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; pgsql-general <pgsql-general@lists.postgresql.org>

On Thu, Jul 8, 2021 at 2:30 AM Bruce Momjian <bruce@momjian.us> wrote:
> Also, pg_upgrade will throw an error if copying from one version to the
> same version if there are tablespaces since the tablespace directory
> name is the catalog version name.

A very good point to discourage this usage!

Thanks,
Luca





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-07-12 09:38 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 06:53 pg_upgrade as a way of cloning an instance? Luca Ferrari <fluca1978@gmail.com>
2021-07-07 08:22 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2021-07-07 08:30   ` Luca Ferrari <fluca1978@gmail.com>
2021-07-08 00:30     ` Bruce Momjian <bruce@momjian.us>
2021-07-12 09:38       ` Luca Ferrari <fluca1978@gmail.com>

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