-create unique index snapshot_contents_unique
- on snapshot_contents(blockid, snapshotid);
-
--- Summary statistics for each segment.
-create view segment_info as select * from
- (select segmentid, max(timestamp) as mtime,
- sum(size) as size, count(*) as objects
- from block_index join segments using (segmentid) group by segmentid)
-natural join
- (select segmentid, sum(size) as used, count(*) as objects_used
- from block_index where blockid in
- (select blockid from snapshot_contents) group by segmentid);
+create unique index segments_used_index
+ on segments_used(snapshotid, segmentid);