Re: create database from template requires the source database to be unused

From: "Haszlakiewicz, Eric" <EHASZLA(at)transunion(dot)com>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>, Tim Uckun <timuckun(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: create database from template requires the source database to be unused
Date: 2012-06-28 15:10:44
Message-ID: 4EB74494E20A13478F64930FDE244D6402673105@CHO3WUC9MBX11.corp.transunion.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2012-06-28 15:49:02 Re: create database from template requires the source database to be unused
Previous Message tuanhoanganh 2012-06-28 14:41:03 Postgresql 9.0.6 alway run VACUUM ANALYZE pg_catalog.pg_attribute