[GENERAL] Natural key woe

2014-05-13 Thread Oliver Kohll - Mailing Lists
I'm sure no one else on this list has done anything like this, but here's a cautionary tale. I wanted to synchronise data in two tables (issue lists) - i.e. whenever a record is added into one, add a similar record into the other. The two tables are similar in format but not exactly the same

Re: [GENERAL] Natural key woe

2014-05-13 Thread Robin
Oliver I've read your email, with interest. I haven't had to deal with this sort of problem in PostgreSQL, but I have frequently dealt with it in a Sybase environment, first encountered about 25 years ago. I am most curious to know why you didn't use the same sequence for both tables, I

Re: [GENERAL] Natural key woe

2014-05-13 Thread Eelke Klein
One other wrinkle to note. After clearing out these rows, running 'VACUUM table2', 'ANALYZE table2' and 'REINDEX table table2', some queries with simple sequence scans were taking a few seconds to run even though there are only a thousand rows in the table. I finally found that running

Re: [GENERAL] Natural key woe

2014-05-13 Thread Yeb Havinga
On 13/05/14 11:44, Oliver Kohll - Mailing Lists wrote: The problem came when someone entered a record with no subject, but left it null. When this was copied over and present in both tables, the *next* time the join was done, a duplicate was created because the join didn't see them as