Professional Documents
Culture Documents
Designing Dimension Tables
Designing Dimension Tables
Designing Dimension Tables
Product
Price name, color, style,
size
Store Section
Region Department
Business unit
Because, in all cases, the query constrains the set of products in a variety of ways, the
query can be speeded up if all the constraining information is in the same table. In
practice, this is achieved by denormalizing all the additional entities related to the
product entity into a single product table (Figure 5.13).
For example, we would take all the. product hierarchy information. and
denormalize it into the same row (that is, one column per level in the hirarchy).
Attributes such as size, color, material, style, would be added to each row as well
(Figure 5.14).
This techntque works well in situations where there are a number of entities
related to the key dimension entity, which are accessd often. There is a
performance
saving of not having to join additional tables to access those attributes.
This technique may not be appropriate in situations where the additional data is
not accessed very often, because the overhead
of scanning the expanded dimension
table may not be offset by the gain in the query. If the bulk of queries don't access
those columns, this technique will speed up a minority of queries by slowing down
the majority.
It may not be possible to denormalize all entities into star dimensions. Specifically,
all entities that are related through many-to-many relationships should not be
denormalized into a star dimension: that is, it is not efficient to denormalize multiple
values into a single row.
For example, many retailers use multiple product hierarchies to represent
different product views. These could be:
the product group hierarchies (e.g. business unit, sub-business unit, section,
department, SKU);
and a number of hierarchies where each one represents:
In many cases, some (if not all) of the dimensions will vary over time. This is
particularly for dimensions that use hierarchies or networks to group basic
true
concepts, because the business will probably change the way in which it categorizes
the dimension over a period of time.
For example, in the retail sector, he product dimension typically contains a
hierarchy used to categorize products into departments, sections, business units, and so
on. As the business changes, it is standard practice to re-categorize these products. Tee
shirts could move from menswear into unisex; baked beans could move from canned
foods to canned vegetables.
Depending on the business requirement, it may be necessary to support queries
that compare facts within a grouping that exists at present, with the grouping that
existed at a point of time in the past. These queries tend to be used to understand
whether various business policies have been successful (referred to as *as is, as was"
queries).
For example, take a case where a department store manager is investigating
whether a policy of upgrading the quality of products in the menswear department
was successful. In order to address that query, we must examine the revenue and
Day
date
Six-week
period
Month
Year