Considering that you have tagged this post with data-warehouse
and datamart
, I can only assume that your FT table is some kind of a fact and that the query looks something like:
select
CalendarMonth
, sum(x) as Tot_1
, sum(x) * sum(y) as Tot_2
, sum(x) + sum(z) as Tot_3
from FT as f
join dimDate as d on d.DateKey = f.DateKey
join dimUser as u on u.UserKey = f.UserKey
join dimProduct as p on p.ProductKey = f.ProductKey
where CalendarYear between 2008 and 2010
and Country = 'United States'
and ProductCategory = 'Cool Gadget'
and UserGender = 'Female'
group by CalendarMonth ;
Which is exactly how an aggregation over measures in a fact table should look like.
Now, for reporting purposes, it seems that you have an aggregation table (FA) to speed-up reports. I can only guess that the warehouse is loaded over night and that your query prepares the aggregation sometimes in the morning, before business hours, so it runs once per day -- or at least is supposed to. If this query takes too long to run, consider adding few key fields to your aggregation table (FA) -- usually DateKey -- then update the FA table periodically.
For example, if you have 10,000 sales per day than the above query sums ~ 300,000 rows for each month. If the aggregation table is aggregated per day, than it takes sum of 10,000 rows once per day to update the table, and sum of only 30 rows per month for a report.
To summarize, in order to speed-up fact aggregation queries focus on number of rows that are aggregated -- not on aggregate functions. Also, make sure that dimension tables have indexes on columns mentioned in the WHERE clause of the query.
Admittedly, I may have assumed too much here, so this may or may not be helpful.