Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9kIA-0006Bu-J2 for pgsql-sql@arkaria.postgresql.org; Fri, 29 Mar 2019 05:43:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h9kI7-0004F4-I0 for pgsql-sql@arkaria.postgresql.org; Fri, 29 Mar 2019 05:42:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9kI7-0004Ex-9J for pgsql-sql@lists.postgresql.org; Fri, 29 Mar 2019 05:42:59 +0000 Received: from mail.i-mark.de ([188.138.104.222]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9kI4-00052R-N8 for pgsql-sql@lists.postgresql.org; Fri, 29 Mar 2019 05:42:58 +0000 Received: from OnePlus3.fritz.box (unknown [185.38.49.7]) by mail.i-mark.de (Postfix) with ESMTPSA id 1280715805D1; Fri, 29 Mar 2019 06:42:53 +0100 (CET) Authentication-Results: loft7616.startdedicated.de; spf=pass (sender IP is 185.38.49.7) smtp.mailfrom=andreas@a-kretschmer.de smtp.helo=OnePlus3.fritz.box Received-SPF: pass (loft7616.startdedicated.de: connection is authenticated) Date: Fri, 29 Mar 2019 06:42:52 +0100 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: Archival process of partition tables with filtering few rows from tables. To: pgsql-sql@lists.postgresql.org,github kran ,pgsql-general ,pgsql-sql@postgresql.org From: Andreas Kretschmer Message-ID: <304BE2C2-7064-4AD7-99CE-C0723D648E1D@a-kretschmer.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 29 March 2019 05:13:31 CET, github kran wrote: >Hello Team, > >We are using PostgreSQL Version 9=2E6 and planning to archive our >partition >tables containing about 300 - 500 million rows =2E We have around ~ 50 >partition tables to be archived to a new >cold path PostgreSQL database , version 10=2E6=2E Consider Version 11 instead, much better features for partitioning=2E We have a requirement to >filter few rows before exporting this data from these tables as we dont >want to archive those rows =2E > > What is a better approach to export and restore these tables ?=2E > >- Does COPY Command with a filter query to filter few rows using select > works better ?=2E > - pg_dump with filtering these rows ?=2E > - Can i able to export my indexes , check constraints , constraints ?=2E > - Any other options ?=2E Yeah, consider logical replication using pg_logical from us with row filte= ring=2E Regards, Andreas --=20 2ndQuadrant - The PostgreSQL Support Company