pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Asmir Mustafic <goetas@lignano.it>
To: pgsql-performance@postgresql.org
Subject: 700K Inserts in transaction
Date: Thu, 14 Feb 2013 11:28:37 +0100
Message-ID: <511CBC55.9080804@lignano.it> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

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



view thread (2+ messages)  latest in thread

Message-ID: <511CBC55.9080804@lignano.it>
Permalink:  ../511CBC55.9080804@lignano.it/
Also on:    postgresql.org/message-id/511CBC55.9080804@lignano.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: goetas@lignano.it
  Subject: Re: 700K Inserts in transaction
  In-Reply-To: <511CBC55.9080804@lignano.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox