On 12/30/2013 8:14 AM, Janek Sendrowski wrote:
Hi,
I want to insert data in my table and I want to insert the rows, which don't
violates the unique contraint of my id. I'm using a 64bit hash for my it.
If I do one insert statement, which inserts many rows it doesn't do anything if
one row violates the unique contraint.
Is there a faster way than using multiple insert statements?
Janek
You could:
create table junk (like main);
copy to junk ...;
create index junkpk on junk(uid);
-- _not_ a unique index, optional
analyze junk;
select uid, count(*) from junk group by uid;
-- do something about the dups
insert into main select * from junk;
drop table junk;
-Andy
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general