Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #576

the performance cost of a postgresql key violation exception

Newsgroups comp.databases.postgresql
Date 2014-07-19 11:07 -0700
Message-ID <ed6a893b-3427-4f69-b574-2eb9d0d79b75@googlegroups.com> (permalink)
Subject the performance cost of a postgresql key violation exception
From stoicism1@aol.com

Show all headers | View raw


In my postgresql database, I have a unique key constraint called reports_uniqueness_index. Each record in table must have a unique unit_id, time, latitude, and longitude. I have a multi-threaded application. Each worker threads inserts a record into the table. So multiple threads could be doing this at the same time. As a result, I often get the following postgresql error:

    org.postgresql.util.PSQLException: ERROR: duplicate key value 
      violates unique constraint "reports_uniqueness_index"

What is the cost performance of this? I do not want to synchronize the insert statement in my threads, because that would defeat the purpose of using a database cocnnection pool (as one thread must wait for another thread to finish database insertion).

Back to comp.databases.postgresql | Previous | NextNext in thread | Find similar


Thread

the performance cost of a postgresql key violation exception stoicism1@aol.com - 2014-07-19 11:07 -0700
  Re: the performance cost of a postgresql key violation exception Dimitri Fontaine <dimitri@2ndQuadrant.fr> - 2014-07-20 14:51 +0200

csiph-web