Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pPtBj-0007Dt-Nk for pgsql-general@arkaria.postgresql.org; Wed, 08 Feb 2023 22:45:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pPtBi-0007iD-9n for pgsql-general@arkaria.postgresql.org; Wed, 08 Feb 2023 22:45:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pPtBh-0007hy-VW for pgsql-general@lists.postgresql.org; Wed, 08 Feb 2023 22:45:13 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pPtBf-0002zF-JC for pgsql-general@postgresql.org; Wed, 08 Feb 2023 22:45:12 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4PBw752bM9z9sZK; Wed, 8 Feb 2023 23:45:05 +0100 (CET) Date: Wed, 8 Feb 2023 23:45:04 +0100 (CET) From: Erik Wienhold To: Andrus , depesz@depesz.com Cc: pgsql-general Message-ID: <1169630167.178680.1675896304462@office.mailbox.org> In-Reply-To: <6422167c-c725-d305-5ee5-d16f310e7fc7@hot.ee> References: <6da54c55-6752-ca53-cdc8-2342b2c75258@hot.ee> <531831758.189866.1675891078338@office.mailbox.org> <6422167c-c725-d305-5ee5-d16f310e7fc7@hot.ee> Subject: Re: How to create directory format backup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 08/02/2023 22:37 CET Andrus wrote: > > > > How to create backup in format from which tables can selectively > > > restored? > > > > > Dump as custom-format archive (-F custom) and use that with pg_restore > > and options --table or --list/--use-list to select what should be > > restored. > > > How to select tables interactively like pgAdmin allows to select when > directory format is used ? > > Database contains hundreds of schemas. I need to restore public and other > other schema. > > Whole backup file is scanned to restore only two schemas. It takes lot of > time. pg_dump also accepts options --table and --schema to only dump what you need. > Also directory format allows to use all cores with --jobs=32 parameter. > Dump and partial restore using custom format are much slower. Run multiple pg_dump processes in parallel where each processes a subset of tables with the options mentioned above. -- Erik