资源描述:
《fact tables and dimension tables事实表和维度表》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、FactTablesandDimensionTablesThelogicalfoundationofdimensionalmodelingbyRalphKimballJanuary1,2003Dimensionalmodelingisadesigndisciplinethatstraddlestheformalrelationalmodelandtheengineeringrealitiesoftextandnumberdata.Comparedtoentity/relationmodeling,it'
2、slessrigorous(allowingthedesignermorediscretioninorganizingthetables)butmorepracticalbecauseitaccommodatesdatabasecomplexityandimprovesperformance.Contrastedwithothermodelingdisciplines,dimensionalmodelinghasdevelopedanextensiveportfoliooftechniquesforha
3、ndlingreal-worldsituations.MeasurementsandContextDimensionalmodelingbeginsbydividingtheworldintomeasurementsandcontext.Measurementsareusuallynumericandtakenrepeatedly.Numericmeasurementsarefacts.Factsarealwayssurroundedbymostlytextualcontextthat'strueatt
4、hemomentthefactisrecorded.Factsareveryspecific,well-definednumericattributes.Bycontrast,thecontextsurroundingthefactsisopen-endedandverbose.It'snotuncommonforthedesignertoaddcontexttoasetoffactspartwaythroughtheimplementation.Althoughyoucouldlumpallconte
5、xtintoawide,logicalrecordassociatedwitheachmeasuredfact,you'llusuallyfinditconvenientandintuitivetodividethecontextintoindependentlogicalclumps.Whenyourecordfacts—dollarsalesofagrocerystorepurchaseofanindividualproduct,forexample—younaturallydividethecon
6、textintoclumpsnamedProduct,Store,Time,Customer,Clerk,andseveralothers.Wecalltheselogicalclumpsdimensionsandassumeinformallythatthesedimensionsareindependent.Figure1showsthedimensionalmodelforatypicalgrocerystorefact.Intruth,dimensionsrarelyarecompletelyi
7、ndependentinastrongstatisticalsense.Inthegrocerystoreexample,CustomerandStoreclearlywillshowastatisticalcorrelation.Butit'susuallytherightdecisiontomodelCustomerandStoreasseparatedimensions.Asingle,combineddimensionwouldlikelybeunwieldywithtensofmillions
8、ofrows.AndtherecordofwhenagivencustomershoppedinagivenstorewouldbeexpressedmorenaturallyinafacttablethatalsoshowedtheTimedimension.Theassumptionofdimensionindependencewouldmeanthatallthedimensions,suchasProduct,Store,andCu