Professional Documents
Culture Documents
Fast Changing Dimensions are dimensions that keep changing rapidly. Previously we had discussed about slowly changing dimension, which can be handled by Type1,Type2 or Type3.In case of rapidly changing dimension it cannot be managed by any of these Types. For RAPIDLY CHA !I ! DI"# $I% we need to split the actual dimension table into many ini Dimensions. These ini dimensions can be one ore more and will contain the Fast Changing attributes in the dimensions !o now there will be one or more mini dimensions and primary dimension table. "lso the fact table will have two or more foreign keys, one for the primary dimension table and another for the one or more mini#dimensions. $ence we will have two dimensions now, %ne table is the actual dimension minus the fast changing attributes. "nother is the mini dimensions having the fast changing attributes.
Junk Dimension
The method that we are going to consider here assumes the fact that, not all the attributes of a dimension table are rapidly changing in nature. There might be a few attributes which are changing
*uite often and some other attributes which seldom change. If we can separate the fast changing attributes from the slowly changing ones and move them in some other table while maintaining the slowly changing attributes in the same table, we can get rid of the issue of bulking up the dimension table. !o let,s take one e-ample to see how it works. .et,s say C/!T% 01 dimension has following columns2
C/!T% 013405 C/!T% 013+" 0 C/!T% 01360+D01 C/!T% 013 "1IT".3!T"T/! C/!T% 013TI01 C/!T% 013!T"T/!
7hile attributes like name, gender, marital status etc. do not change at all or rarely change, let,s assume customer tier and status change every month based on customer,s buying pattern. If we decide to keep status and tier in the same !CD Type ' Customer dimension table, we could risk filling# up the table too much too soon. Instead, we can pull out those two attributes in yet another table, which some people refer as 8/+4 DI 0+!I%+. $ere is how our 9unk dimension will look like. In this case, it will have : columns as shown below.
The column !06 0+T"TI%+3405 is a surrogate key. This acts as the primary key of the table. "lso since we have removed status and tier from our main dimension table, the dimension table now looks like this2
+e-t, we must create a linkage between the above customer dimension to our newly created 8/+4 dimension. +ote here, we can not simply pull the primary key of the 8/+4 dimension (which we are calling as !06 0+T"TI%+3405) into the customer dimension as foreign key. &ecause if we do so, then any change in 8/+4 dimension will re*uire us to create a new record in Customer dimension to refer to the changed key. This would in effect again increase the data volume of the dimension table. 7e solve this problem by creating one more mini table in between the original customer dimension and the 9unk dimension. This mini dimension table acts as a bridge between them. 7e also put ;start date< and
;end date< columns in this mini table so that we can track the history. $ere is how our new mini table looks like2
This table does not re*uire any surrogate key. $owever, one may include one ;C/110+T F."6< column in the table if re*uired. +ow the whole model looks like this2
It,s also worth mentioning that in this schema, we can manage the original customer dimension table in !CD type @ or Type ' methods, but we will have to take e-tra care to update the mini dimension also as and when there is a change in the key in the original dimension table.
##################################################################################################################### ###################
0mployee Code D &usiness /nit # C0@C D C&/@C or C0@C D C&/'.C &ut the difference with the natural key enlargement process, is that you might not have all part of your new key within your fact table, so you might not be able to do the 9oin on the new enlarge key #E so you need another id. !urrogate key by nature is number , so for 9oining or while processing comple- *uerry it will take lesser time for integer comparison comparative to character comparison. !urrogate is mainly used in slowly changing dimensions,it maintaining the uni*ueness in the table.it is used to track the old value with the new one."nd it is derived from primary key.