Database Reference
In-Depth Information
dimension since OLAP queries are highly demanding, and there is no time
to perform such computations each time a fact must be summarized. For
example, a query like “Total sales during weekends,” posed over the schema
of Fig. 5.1 , would be easily evaluated with the following SQL query:
SELECT SUM(SalesAmount)
FROM Time T, Sales S
WHERE T.TimeKey = S.TimeKey AND T.WeekendFlag
The granularity of the time dimension varies depending on their use. For
example, if we are interested in monthly data, we would define the time
dimension with a granularity that will correspond to a month. Thus, the time
dimension table of a data warehouse spanning 5 years will have 5
12 = 60
tuples. On the other hand, if we are interested in more detailed data, we could
define the time dimension with a granularity that corresponds to a second.
Thus, the same data warehouse as above will have a time dimension with
5
×
3 , 600 = 155 , 520 , 000 tuples. The time dimension has the
particularity that it can be (and in practice it is) populated automatically.
Finally, note that time dimension may have more than one hierarchy (recall
our calendar/fiscal year example in Fig. 4.9 ). Further, even if we use a single
hierarchy, we must be careful to satisfy the summarizability conditions. For
example, a day aggregates correctly over a month and a year level (a day
belongs to exactly 1 month and 1 year), whereas a week may correspond to
2 different months, and thus the week level cannot be aggregated over the
month level in a time dimension hierarchy.
×
12
×
30
×
24
×
5.5 Logical Representation of Hierarchies
The general mapping rules given in the previous section do not capture the
specific semantics of all of the kinds of hierarchies described in Sect. 4.2 .
In addition, for some kinds of hierarchies, alternative logical representations
exist. In this section, we consider in detail the logical representation of the
various kinds of hierarchies studied in Chap. 4 .
5.5.1 Balanced Hierarchies
As we have seen, in a conceptual multidimensional schema, the levels of
dimension hierarchies are represented independently, and these levels are
linked by parent-child relationships. Therefore, applying the mapping rules
giveninSect. 5.3 to balanced hierarchies leads to snowflake schemas
described before in this chapter: each level is represented as a separate table,
which includes the key and the attributes of the level, as well as foreign keys
for the parent-child relationships. For example, applying Rules 1 and 3b to
Search WWH ::




Custom Search