Re: create database from template requires the source database to be unused - Mailing list pgsql-general

From Haszlakiewicz, Eric
Subject Re: create database from template requires the source database to be unused
Date
Msg-id 4EB74494E20A13478F64930FDE244D6402673105@CHO3WUC9MBX11.corp.transunion.com
Whole thread Raw
In response to Re: create database from template requires the source database to be unused  (Craig Ringer <ringerc@ringerc.id.au>)
Responses Re: create database from template requires the source database to be unused
List pgsql-general
> -----Original Message-----
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> It'd be really interesting to relax that limitation to "... other
> non-read-only transaction ... " and have a database that's being cloned
> block or reject
> DML, UPDATE, etc. There are some issues with that though:
> 
> (a) Transactions are read/write by default. Most apps don't bother to
> SET TRANSACTION READ ONLY or BEGIN READ ONLY TRANSACTION . Most
> non-read-only transactions will make no changes, but the database can't
> know that until they complete.
> 
> (b) AFAIK even truly read-only transactions can set hint bits and
> certain other system level database metadata.
> 
> (c) Because of (a) it'd be necessary to block your CREATE DATABASE ...
> TEMPLATE ... until all transactions finished and sessions were idle, or
> to abort all transactions and roll them back.

I've read that postgres uses MVCC for transactions, and that it creates 
snapshots of the database for each transaction.  Couldn't the create
database command just use that snapshot?

eric

pgsql-general by date:

Previous
From: tuanhoanganh
Date:
Subject: Postgresql 9.0.6 alway run VACUUM ANALYZE pg_catalog.pg_attribute
Next
From: Alban Hertroys
Date:
Subject: Re: create database from template requires the source database to be unused