>> insert into X
>> select a.keyA,
>> a.keyB,
>> a.colA,
>> a.colB
>> from Y a left join X b
>> using (keyA, keyB)
>> where b.keyA is NULL and
>> b.keyB is NULL;
>>
>> With the appropriate indexes, this is pretty fast but I think a merge
>> would be much faster.
Problem is it's subject to race conditions if another process is
inserting stuff at the same time...
Chris