-- This query gets the rough GB served per month from SQL queries on a given database name (pattern).
-- The query assumes a fiducial average row size of 100 bytes and hence divides the total number of
-- rows per month by 10^7 (i.e. 10^9/100) to get the approximate # of GBs returned to the user.

select yy, mm as mth, cast(sum(rows) as float)/10000000 as GB 
into mydb.MonthyGBforDR8 
from sqllogall
where yy >=2011 and dbname like '%dr8'
group by yy, mm
order by yy, mm
