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 1khy7s-0007j7-LJ for pgsql-general@arkaria.postgresql.org; Wed, 25 Nov 2020 16:58:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1khy7r-0001NE-L4 for pgsql-general@arkaria.postgresql.org; Wed, 25 Nov 2020 16:58:39 +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 1khy7r-0001Mi-Di for pgsql-general@lists.postgresql.org; Wed, 25 Nov 2020 16:58:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1khy7l-0006Ir-9m for pgsql-general@lists.postgresql.org; Wed, 25 Nov 2020 16:58:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0APGwTCc493979; Wed, 25 Nov 2020 11:58:29 -0500 From: Tom Lane To: Mats Julian Olsen cc: Adrian Klaver , pgsql-general@lists.postgresql.org Subject: Re: postgres_fdw insert extremely slow In-reply-to: <10df210c-a1bb-f909-9a48-61ac54880df0@duneanalytics.com> References: <3862aa4d-01c7-c76b-4497-ebce1af702cc@aklaver.com> <10df210c-a1bb-f909-9a48-61ac54880df0@duneanalytics.com> Comments: In-reply-to Mats Julian Olsen message dated "Wed, 25 Nov 2020 17:48:50 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <493977.1606323509.1@sss.pgh.pa.us> Date: Wed, 25 Nov 2020 11:58:29 -0500 Message-ID: <493978.1606323509@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mats Julian Olsen writes: >> Postgres version(s)? > x: Aurora PostgreSQL 11.7 on x86_64-pc-linux-gnu, compiled by gcc (GCC) > 4.9.3, 64-bit (RDS) > y: PostgreSQL 12.2 (Ubuntu 12.2-2.pgdg19.10+1) on x86_64-pc-linux-gnu, > compiled by gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008, 64-bit (GCP) Hmm, I wonder if Aurora could be doing something funny here? Anyway, to answer your question, no that's not the expected level of performance. postgres_fdw is certainly not inexpensive compared to local table access, but I'd still think inserts should take only a small number of milliseconds. It seems like something must be blocking the query. Have you tried looking into pg_locks on the remote server while this query is running? regards, tom lane