From: alexandre :: aldeia digital <alexandre@aldeiadigital.com.br>
To: pgsql-sql@postgresql.org
Subject: Abort Transaction DP PK (again)
Date: Thu, 7 Aug 2003 14:04:30 -0300 (BRT)
Message-ID: <1108.200.170.156.137.1060275870.squirrel@webmail.ad2.com.br> (raw)
Hi,
I know that this topic was discuted before but I like an alternative for
my high load INSERT query.
Why Postgres abort a transaction when find a duplicate PK ?!?!
A simple Fuction test:
(...)
SELECT a,b from foo where a=1 and b=1
IF NOT FOUND
INSERT INTO foo VALUES(1,1)
ELSE
UPDATE
(...)
Is, obviously, very very much slower than this (hipotetic) function:
(...)
INSERT INTO foo
IF "ERROR DP PK"
UPDATE
(...)
In both cases, INSERT will test if values violate the PK... but in first
example the extra SELECT cause an unnecessary extreame work...
Thanks,
Alexandre
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-sql@postgresql.org
Cc: alexandre@aldeiadigital.com.br
Subject: Re: Abort Transaction DP PK (again)
In-Reply-To: <1108.200.170.156.137.1060275870.squirrel@webmail.ad2.com.br>
* 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