Search code examples
sqldatabaseoracle-databasedata-warehousedimensional-modeling

What's the Grain in the context of DW


According to The Data Warehouse Toolkit by Kimball

"The grain must be declared before choosing dimensions
or facts because every candidate dimension or fact must be consistent with the grain."

I'm so confused about this concept .Could some one illustrate what's the meaning of Grain giving an analogy or metaphor in real life to clarify the concept .


Solution

  • Some examples:

    • "The sales table has a grain of DAY, STORE, PRODUCT"
    • "The sales table has a grain of DAY, STORE, PRODUCT, CUSTOMER"
    • "The sales table has a grain of HOUR, STORE, CUSTOMER"
    • "The sales summary table has a grain of DAY, STORE, PRODUCT_CLASS"

    Hence the time dimension must support HOUR and DAY, and the product dimension must support PRODUCT and PRODUCT_CLASS.