Abort Transaction DP PK (again)

From: "alexandre :: aldeia digital" <alexandre(at)aldeiadigital(dot)com(dot)br>
To: pgsql-sql(at)postgresql(dot)org
Subject: Abort Transaction DP PK (again)
Date: 2003-08-07 17:04:30
Message-ID: 1108.200.170.156.137.1060275870.squirrel@webmail.ad2.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Marc G. Fournier 2003-08-07 17:49:43 Testing gateway
Previous Message Robert Treat 2003-08-07 15:43:42 Re: [GENERAL] Postgresql slow on XEON 2.4ghz/1gb ram