Hello.
I need to make statistics on latest periods for example for user views like this:
userId | Hour | Day | Month | Year
Now I was planning to do how:
Create 4 windows aggregation query
table_views_by_hour
table_views_by_day
table_views_by_month
table_views_by_year
and then create join table
create table ALL_STATISTIC as select
h.userId, h.val as hour, d.val as day, m.val as month, y.val as year
from table_views_by_hour h
JOIN table_views_by_day d on ...
JOIN table_views_by_month m on ...
JOIN table_views_by_year y on ..
How is this the best option? Or do you have tips on how to do better?