Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDesc-0008Gb-9u for pgsql-admin@arkaria.postgresql.org; Fri, 10 Jul 2015 20:26:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZDesb-0004qG-Mp for pgsql-admin@arkaria.postgresql.org; Fri, 10 Jul 2015 20:26:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZDequ-0002v6-73 for pgsql-admin@postgresql.org; Fri, 10 Jul 2015 20:24:56 +0000 Received: from mimolette.dalibo.net ([212.85.154.222]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZDeqm-0002kB-Gs for pgsql-admin@postgresql.org; Fri, 10 Jul 2015 20:24:54 +0000 Received: from [192.168.0.4] (aur75-1-78-192-238-147.fbxo.proxad.net [78.192.238.147]) by mimolette.dalibo.net (Postfix) with ESMTPSA id 447EF6019D8; Fri, 10 Jul 2015 22:24:16 +0200 (CEST) Message-ID: <55A029F0.70007@dalibo.com> Date: Fri, 10 Jul 2015 22:24:16 +0200 From: Julien Rouhaud User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Campbell, Lance" , "pgsql-admin@postgresql.org" Subject: Re: pg_dump a schema with data References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org On 10/07/2015 22:03, Campbell, Lance wrote: > PostgreSQL 9.4 > > Assume you do the following command which dumps all of the data > associated with a schema: > > > > pg_dump –schema=schemaName dbName > schemaName.out > > > > Assume there are some 50 tables in the schema. Some of these tables > have foreign keys to each other. During the dump of the schema, I would > assume each table would be frozen/locked while it is being dumped. But > what about tables that have associates to a table that is being written > out. Will they be locked/frozen also. Or does postgresql lock up all > of the tables within the schema while it is being dumped. Or are you > just taking a risk that there might be miss associations between tables > once the dump is complete. > > > > My guess is that individual tables are locked/frozen while writing. I > would also assume there might be relationship issues between related > tables if there was a lot of writing or deleting during the dump. > > The tables aren't heavily locked or freezed during a pg_dump. The only locks on the tables are put to prevent them from being deleted or their definition changed, but concurrent DML isn't a problem. A pg_dump is consistent because it uses the "repeatable read" transaction isolation. You can look at the documentation for more information: http://www.postgresql.org/docs/current/static/transaction-iso.html#XACT-REPEATABLE-READ Regards. > > Thanks, > > > > Lance Campbell > > University of Illinois > -- Julien Rouhaud http://dalibo.com - http://dalibo.org -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin