select 'Merging Stage into requests'; insert into requests select * from stage where not exists (select 1 from requests where requests.id=stage.id); drop table stage; select 'Vacuuming the DB'; vacuum;