Re: [PERFORM] perform 1 check vs exception when unique_violation

2008-12-30 Thread Robert Haas
On Tue, Dec 30, 2008 at 5:41 AM, Anton Bogdanovitch wrote: > I have to insert rows to table with 95% primary key unique_violation. If you're inserting a lot of rows at once, I think you're probably better off loading all of the data into a side table that does not have a primary key, and then wri

[PERFORM] perform 1 check vs exception when unique_violation

2008-12-30 Thread Anton Bogdanovitch
I have to insert rows to table with 95% primary key unique_violation. I've tested 2 examples below: 1) BEGIN INSERT INTO main (name, created) VALUES (i_name, CURRENT_TIMESTAMP AT TIME ZONE 'GMT'); EXCEPTION WHEN UNIQUE_VIOLATION THEN RETURN 'error: already exists'; END; RETURN 'ok: s