/[BackupPC]/trunk/sql/backups_full.sql
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/sql/backups_full.sql

Parent Directory Parent Directory | Revision Log Revision Log


Revision 103 - (show annotations)
Tue Aug 30 22:43:57 2005 UTC (18 years, 8 months ago) by dpavlin
File size: 609 byte(s)
added very complex backup query (which is slow, probably a good candidate
for materilaized view)

1 -- report number of files and staticics for each backup
2
3 select
4 hosts.name as host,
5 shares.name as share,
6 backupnum as num,
7 backups.date as backup_date,
8 backups.type as type,
9 min(files.date) as from,
10 max(files.date) as to,
11 count(*) as files,
12 sum(files.size) as size,
13 sum(backups.size) as backup_size
14 from files
15 join shares on files.shareid=shares.id
16 join hosts on shares.hostid = hosts.id
17 join backups on shares.hostid = backups.hostid
18 and files.backupnum = backups.num
19 and shares.id = backups.shareid
20 group by shares.name, hosts.name, backupnum, backups.date, backups.type
21 order by backups.date;

  ViewVC Help
Powered by ViewVC 1.1.26