Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5w3G-00007u-PX for pgsql-performance@arkaria.postgresql.org; Thu, 14 Feb 2013 10:28:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U5w3G-0007eQ-6r for pgsql-performance@arkaria.postgresql.org; Thu, 14 Feb 2013 10:28:26 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5w3F-0007eK-58 for pgsql-performance@postgresql.org; Thu, 14 Feb 2013 10:28:25 +0000 Received: from falso.netanday.it ([194.184.207.2]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5w3C-00089E-Df for pgsql-performance@postgresql.org; Thu, 14 Feb 2013 10:28:24 +0000 Received: from [194.184.207.136] (unknown [194.184.207.136]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falso.netanday.it (Postfix) with ESMTPS id 6B568A9398 for ; Thu, 14 Feb 2013 11:28:19 +0100 (CET) Message-ID: <511CBC55.9080804@lignano.it> Date: Thu, 14 Feb 2013 11:28:37 +0100 From: Asmir Mustafic User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: 700K Inserts in transaction Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.1 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hi everybody! I'm new in mailing list, and i have a little question. The tables are: postalcodes (place_id, code), PK(place_id, code) 600K of rws places (id, name), PK(id), INDEX(name) 3M of rows I've to insert another 600k of rows into postalcodes table, in a single transaction, omitting duplicates. The insert query is a prepared statement like this: INSERT INTO postalcodes (place_id, code) SELECT places.id, :code FROM places LEFT JOIN postalcodes (postalcodes.place_id = places.id and postalcodes.code = :code) WHERE places.name = :name AND postalcodes.place_id IS NULL Inserting rows works well (3000 queries per second), but when i reach 30K of executed statements, the insert rate slows down to 500/1000 queries per second). Doing a commit every 20K of inserts, the insert rate remain 3000 queries per second. There is a limit of inserts in a transaction? -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance