Translate topic in your language

Sunday 18 July 2021

DWH Type of Dimension Tables in dataware Housing

 

Types of Dimensions



 



Dimension



A dimension table typically has
two types of columns, primary keys to fact tables and
textual\descriptive data.



Eg: Time, Customer



 








 



Types of Dimensions



 



1.         
Slowly Changing Dimensions



2.         
Rapidly Changing Dimensions



3.         
Junk Dimensions



4.         
Inferred Dimensions



5.         
Conformed Dimensions



6.         
Degenerate Dimensions



7.         
Role Playing Dimensions



8.         
Shrunken Dimensions



9.         
Static Dimensions 



 





Slowly
Changing Dimensions



Dimension attributes that change slowly
over a period of time rather than changing regularly is grouped as SCDs.
 Attributes like name, address can change but not too often.



These attributes can change over a
period of time and that will get combined as a slowly changing dimension.
Consider an example where a person is changing from one city to another. Now
there are 3 ways to change the address;



Type 1  is to over write the old
value, Type 2 is to add a new row and Type 3 is to create a new column.



Type 1



The advantage of type 1 is that it is
very easy to follow and it results  in huge space savings and hence cost
savings. The disadvantage is that no history is maintained.



Type 2



The advantage of type 2 is that the
complete history is maintained. The only disadvantage lies in the huge space
allocation because the entire history right from the start has to be
maintained.



 



Type 3



The best approach could be to add a new
column where you add two new columns. In this case keeping a tracking of the
history becomes very easy.



 



Rapidly Changing Dimensions[fast changing dim]



A dimension attribute that changes
frequently is a rapidly changing attribute. Fast changing dimensions are those
dimensions if one or more of its attributes changes frequently and in many
rows. A fast changing dimension can grow very large if we use the Type-2
approach to track numerous changes. These dimensions some time called rapidly
changing dimensions.





Examples of fast changing dimensions are

Age

Income

Test score

Rating

Credit history score

Customer account

status

Weight



 







Junk Dimensions



A junk dimension is a single table with
a combination of different and unrelated attributes to avoid having a large
number of foreign keys in the fact table. Junk dimensions are often created to
manage the foreign keys created by rapidly changing dimensions.



 







Inferred Dimensions (late coming dimension)



 



While loading fact records, a dimension
record may not yet be ready. One solution is to generate a surrogate key with
null for all the other attributes. This should technically be called an
inferred member but is often called an inferred dimension.



 



Conformed Dimensions



A dimension that is used in multiple
locations is called a conformed dimension. A conformed dimension may be used
with multiple fact tables in a single database, or across multiple data marts
or data warehouses.



 



For example, there are two fact tables. Fact table 1 is to
determine the number of products sold by geography. This table will calculate
just the number of products by geography and fact table 2 will determine the
revenue generated by customer. Both are dependent on the product which contains
product Id, name and source.



 



There is the geography dimension and customer dimension which are
being shared by two fact tables. The revenue fact gives the revenue generated
by both the geography and the customer, while the product units fact gives
number of units sold in the geography to a customer.







 






Degenerate Dimensions



 



A degenerate dimension is when the
dimension attribute is stored as part of fact table, and not in a separate
dimension table. These are essentially dimension keys for which there are no
other attributes. In a data warehouse, these are often used as the result of a
drill through query to analyze the source of an aggregated number in a report.
You can use these values to trace back to transactions in the OLTP system.



 

Role Playing Dimensions



A role-playing dimension is one where
the same dimension key — along with its associated attributes — can be joined
to more than one foreign key in the fact table. For example, a fact table may
include foreign keys for both ship date and delivery date. But the same date
dimension attributes apply to each foreign key, so you can join the same
dimension table to both foreign keys. Here the date dimension is taking
multiple roles to map ship date as well as delivery date, and hence the name of
role playing dimension.



 







 



Shrunken Dimensions



 



A shrunken dimension is a subset of
another dimension. For example, the orders fact table may include a foreign key
for product, but the target fact table may include a foreign key only for
productcategory, which is in the product table, but much less granular.
Creating a smaller dimension table, with productcategory as its primary key, is
one way of dealing with this situation of heterogeneous grain. If the product
dimension is snowflaked, there is probably already a separate table for
productcategory, which can serve as the shrunken dimension.





Static Dimensions



Static dimensions are not extracted
from the original data source, but are created within the context of the data
warehouse. A static dimension can be loaded manually — for example with status
codes — or it can be generated by a procedure, such as a date or time
dimension.



 




No comments:

Post a Comment

Note: only a member of this blog may post a comment.