From: dpavlin Date: Tue, 30 Aug 2005 22:43:57 +0000 (+0000) Subject: added very complex backup query (which is slow, probably a good candidate X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=cd049ee0f805e8102e66298dea7c9a809609cf61;p=BackupPC.git added very complex backup query (which is slow, probably a good candidate for materilaized view) git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@103 8392b6e1-25fa-0310-8288-cc32f8e212ea --- diff --git a/sql/backups_full.sql b/sql/backups_full.sql new file mode 100644 index 0000000..0eca72a --- /dev/null +++ b/sql/backups_full.sql @@ -0,0 +1,21 @@ +-- report number of files and staticics for each backup + +select + hosts.name as host, + shares.name as share, + backupnum as num, + backups.date as backup_date, + backups.type as type, + min(files.date) as from, + max(files.date) as to, + count(*) as files, + sum(files.size) as size, + sum(backups.size) as backup_size +from files +join shares on files.shareid=shares.id +join hosts on shares.hostid = hosts.id +join backups on shares.hostid = backups.hostid + and files.backupnum = backups.num + and shares.id = backups.shareid +group by shares.name, hosts.name, backupnum, backups.date, backups.type +order by backups.date;