added very complex backup query (which is slow, probably a good candidate
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Tue, 30 Aug 2005 22:43:57 +0000 (22:43 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Tue, 30 Aug 2005 22:43:57 +0000 (22:43 +0000)
for materilaized view)

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@103 8392b6e1-25fa-0310-8288-cc32f8e212ea

sql/backups_full.sql [new file with mode: 0644]

diff --git a/sql/backups_full.sql b/sql/backups_full.sql
new file mode 100644 (file)
index 0000000..0eca72a
--- /dev/null
@@ -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;