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 1fytDQ-0004z6-Ng for pgsql-performance@arkaria.postgresql.org; Sun, 09 Sep 2018 06:29:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fytDN-0003Pi-RH for pgsql-performance@arkaria.postgresql.org; Sun, 09 Sep 2018 06:28:57 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fyVzW-00026P-Tk for pgsql-performance@lists.postgresql.org; Sat, 08 Sep 2018 05:41:06 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fyVzT-00058D-9I for pgsql-performance@postgresql.org; Sat, 08 Sep 2018 05:41:06 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 186E5F05E9FC for ; Fri, 7 Sep 2018 22:41:01 -0700 (MST) Date: Fri, 7 Sep 2018 22:41:01 -0700 (MST) From: padusuma To: pgsql-performance@postgresql.org Message-ID: <1536385261054-0.post@n3.nabble.com> In-Reply-To: <8736uk6eh5.fsf@gmail.com> References: <1536339842382-0.post@n3.nabble.com> <8736uk6eh5.fsf@gmail.com> Subject: Re: Performance of INSERT into temporary tables using psqlODBC driver 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 >We are inserting large numbers (millions) of rows into a postgres >database from a Javascript application and found using the COPY command >was much, much faster than doing regular inserts (even with multi-insert >commit). If you can do this using the driver you are using, that will >give you the largest performance boost. The data to be inserted into temporary tables is obtained from one or more queries run earlier and the data is available as a vector of strings. If I need to use COPY FROM command, then the application would need to create a file with the data to be inserted and the file needs to be readable by the user running database server process, which may not be always possible unless the application is running on the same host. I think this approach may not be feasible for our application. I have increased the value for /temp_buffers/ server parameter from the default 8 MB to 128 MB. However, this change did not affect the INSERT time for temporary tables. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html