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