Search Postgresql Archives

Re: continuous copy/update one table to another

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

 



Szymon Guz wrote:
Different doesn't mean that the id should be greater or lower, rather should be different. I'd rather do something like:

indeed, my code assumed that records were only INSERT'd into table1 and never UPDATE or DELETE'd. my statement -did- have the advantage of being fast, at least assuming the id is an index on both tables. if you do update records, you could use a seperate SERIAL/BIGSERIAL field for this, which you update on your INSERT's, and use this bigserial for your inserts, but you'd need a UPSERT kind of function to handle duplicate primary keys.

checking for deletions will be more difficult and more importantly, more time consuming as it will likely require multiple full table scans of both tables.



--
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