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 1iyeIE-0004NZ-0F for pgsql-general@arkaria.postgresql.org; Mon, 03 Feb 2020 16:09:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iyeIC-0003oV-OJ for pgsql-general@arkaria.postgresql.org; Mon, 03 Feb 2020 16:09:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iyeIC-0003oO-Bb for pgsql-general@lists.postgresql.org; Mon, 03 Feb 2020 16:09:44 +0000 Received: from mta1.recol.net ([64.207.103.6]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iyeIA-0001Ly-3D for pgsql-general@lists.postgresql.org; Mon, 03 Feb 2020 16:09:43 +0000 Received: from wrkhors.com (99-105-125-193.uvs.stlsmo.sbcglobal.net [99.105.125.193]) by mta1.recol.net (Postfix) with ESMTPSA id EFD94398A71; Mon, 3 Feb 2020 11:09:40 -0500 (EST) Date: Mon, 3 Feb 2020 10:02:59 -0600 From: Steven Lembark To: pgsql-general@lists.postgresql.org Cc: lembark@wrkhors.com Subject: Re: performance of loading CSV data with COPY is 50 times faster than Perl::DBI Message-ID: <20200203100259.3a2947f6.lembark@wrkhors.com> In-Reply-To: References: <20200131182441.GA8181@c720-r342378> Organization: Workhorse Computing X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Workhorse: Quite 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 > 2. postgres has not implicit plan cache, so every INSERT planned > again and again Good point: If you are doing something in a loop you probably want to use prepare_cached() to get the $sth, for both extract and insert. -- Steven Lembark 3646 Flora Place Workhorse Computing St. Louis, MO 63110 lembark@wrkhors.com +1 888 359 3508