Search Postgresql Archives

Re: discard on constraint violation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>My situation is that I'm reading data from an external website with lots
of duplicate data. I am reading the data in a plpythonu function. I never
update, only insert. A trigger on the table that has to check if each row
exists before trying the insert is too much overhead.

Create a staging table into which you import your external data and then
write a query of the form "INSERT INTO realtable SELECT FROM stagingtable
WHERE stagingtable NOT EXISTS realtable".

David J.




-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux