1 -- fix database to repair found_in_db bug fixed in r74
3 --delete from files where id not in (
4 -- select distinct on(shareid,path,date,size) id
6 -- order by shareid,path,date,size,backupnum asc
9 -- Below is alternative implementation which seems much faster for me.
10 -- You must manually COMMIT your transaction to make changes permanent.
13 select distinct on(shareid,path,date,size) id into temp okids from files order by shareid,path,date,size,backupnum asc;
14 delete from files where id not in (select id from okids) ;