Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fphnx-0000iV-6m for pgsql-performance@arkaria.postgresql.org; Tue, 14 Aug 2018 22:28:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fphnt-00083h-3Q for pgsql-performance@arkaria.postgresql.org; Tue, 14 Aug 2018 22:28: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.89) (envelope-from ) id 1fphns-00083a-Lu for pgsql-performance@lists.postgresql.org; Tue, 14 Aug 2018 22:28:40 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fphno-0005i0-8h for pgsql-performance@postgresql.org; Tue, 14 Aug 2018 22:28:38 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id E73CFE8E7A25 for ; Tue, 14 Aug 2018 15:28:34 -0700 (MST) Date: Tue, 14 Aug 2018 15:28:34 -0700 (MST) From: legrand legrand To: pgsql-performance@postgresql.org Message-ID: <1534285714771-0.post@n3.nabble.com> In-Reply-To: References: <1534194238024-0.post@n3.nabble.com> Subject: Re: Fwd: increase insert into local table from remote oracle table preformance MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk main ideas are: - inserting directly to the right partition: perform as many inserts as pg partitions found in main_table_hist, like INSERT INTO 14/08/2018_value1 select * from remote_oracle_hist where day=to_date('14/08/2018','DD/MM/YYYY') and value='value1' please check execution plan (in Oracle db) using EXPLAIN ANALYZE - all those inserts should be executed in // (with 4 or 8 sql scripts) - wal archiving should be disabled during hist data recovery only (not during day to day operations) - for prefetch see https://github.com/laurenz/oracle_fdw prefetch (optional, defaults to "200") Sets the number of rows that will be fetched with a single round-trip between PostgreSQL and Oracle during a foreign table scan. This is implemented using Oracle row prefetching. The value must be between 0 and 10240, where a value of zero disables prefetching. Higher values can speed up performance, but will use more memory on the PostgreSQL server. Regards PAscal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html