Bacula-users

Re: [Bacula-users] bconsole query for calculating client 7days utilization

2009-12-18 05:40:27
Subject: Re: [Bacula-users] bconsole query for calculating client 7days utilization
From: "Mike Holden" <bacula AT mikeholden DOT org>
To: "bacula-users" <bacula-users AT lists.sourceforge DOT net>
Date: Fri, 18 Dec 2009 10:35:48 -0000
vishal veerkar wrote:
> Hi All,
>
> I would like to calculate the last 7days total backup utilization of my
> clients. I presently using 2.2.8 with Mysql in catalog DB. I was trying to
> tweak one query from query.sql as below. Frankly speaking i am not a DB
> expert and just want to get the job done.
>
> :List all backups for a Client after a specified time and size
> *Enter Client Name:
> *Enter time in YYYY-MM-DD HH:MM:SS format:
> SELECT DISTINCT Job.JobId,Client.Name as Client,Level,StartTime,JobFiles,
> sum(JobBytes) as Totalsize,VolumeName
>  FROM Client,Job,JobMedia,Media
>  WHERE Client.Name='%1'
>  AND Client.ClientId=Job.ClientId
>  AND JobStatus='T'
>  AND JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId
>  AND Job.StartTime >= '%2'
> * GROUP BY Client.Name;*
>
> Actually it gives the out put but the size does not match the actual size.

I'm no Mysql expert, but I am an Oracle expert!

I would expect to see more columns listed in the GROUP BY clause for that 
query. Since
the only column that is aggregated is the sum(JobBytes) part, I would expect 
that all
the other output columns in the query would need to be listed in the GROUP BY 
clause.

If you want size by client, then you don't need to be listing any columns other 
than
Client.Name and sum(JobBytes) in the SELECT clause.
-- 
Mike Holden

http://www.by-ang.com - the place to shop
for all manner of hand crafted items,
including Jewellery, Greetings Cards and Gifts


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users