Tomas Vondra <t...@fuzzy.cz> writes:
> That being said, our CREATE DATABASE docs currently say this

>     Although it is possible to copy a database other than template1 by
>     specifying its name as the template, this is not (yet) intended as
>     a general-purpose "COPY DATABASE" facility. The principal
>     limitation is that no other sessions can be connected to the
>     template database while it is being copied. CREATE DATABASE will
>     fail if any other connection exists when it starts; otherwise, new
>     connections to the template database are locked out until CREATE
>     DATABASE completes. See Section 21.3 for more information.

> I think that this limitation pretty much means no one should use CREATE
> DATABASE for cloning live databases in production environment (because
> of the locking).

Good point.  But the other side of that coin is that if somebody *was*
doing this, the locking would mean that slowing it down would be even
more painful than you might think.  Still, personally I'm willing to
accept that downside, given that we've pretty much always had the above
caveat in the docs.

> It also seems to me the "general-purpose COPY DATABASE" described in the
> docs is what we're describing in this thread.

Well, no, because the restriction "nobody can be connected to the source
database" would still apply; relaxing that would be enormously more
complicated, and probably fragile, than what we're talking about here.

                        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to