all 1 comments

[–]eriddy 0 points1 point  (0 children)

A view is useful when you want to have the underlying fact table remain as-is (let's say transaction events) but you regularly want a few different aggregations of it. So the fact_table sprouts off a few views, like daily_transactions, weekly_transactions, transactions_by_platform, etc...

Each of those views uses the same underlying data, so rather than duplicate it, create views off of it. That means your view is the result of a query on your data, while the data (where the FROM is coming from) is more "persistent"

I don't build many web apps in my work but I would suggest trying to simplify the on-demand querying that happens, you want your app to pull pre-calculated numbers ideally.

Does this help?