1 |
select hostid,shareid,num,abstime(date),size,inc_size into dst_files from backups where date > abstime('2005-10-24')::int order by abstime,hostid,num; |
2 |
|
3 |
delete from backups where date > abstime('2005-10-24')::int; |
4 |
vacuum analyze backups; |
5 |
|
6 |
create index dst_i1 on dst_files(shareid) ; |
7 |
create index dst_i2 on dst_files(num) ; |
8 |
vacuum analyze dst_files ; |
9 |
create index dst_i3 on files(backupnum) ; |
10 |
vacuum analyze files ; |
11 |
|
12 |
select id into dst_files_ids from files inner join dst_files on dst_files.shareid = files.shareid and dst_files.num = files.backupnum ; |
13 |
create unique index dst_i4 on dst_files_ids(id) ; |
14 |
vacuum analyze dst_files_ids ; |
15 |
|
16 |
delete from files where id in (select id from dst_files_ids) ; |
17 |
|
18 |
vacuum full analyze verbose files ; |
19 |
|
20 |
drop table dst_files_ids ; |
21 |
drop table dst_files ; |
22 |
|
23 |
drop index dst_i3 ; |