Fact tables and entities aggregate measures, or the numerical data of a business. To measure data in a fact table or entity, all of the measures in a fact table or entity must be of the same grain.
To obtain the most useful data in a fact table or entity, you should use measures that are both numeric and additive. Using these measures guarantees that data can be retrieved and aggregated, so that the business can make use of the wealth of business data in the database.
Fact tables and entities also contain foreign keys to the dimension tables. These foreign keys relate each row of data in the fact table to its corresponding dimensions and levels.
Fact tables and entities use primary keys that are composite keys. A composite key is made up of a subset of other keys. If a table or entity in a dimensional model uses a composite key, then that table is a fact table or entity. The use of composite keys causes the table or entity to have a many-to-many relationship with other tables and entities in the dimensional model.
Feature | Transaction | Periodic | Accumulating |
---|---|---|---|
Grain | One row per transaction | One row per time period | One row for the entire lifetime of an event |
Dimension | Date dimension at the lowest level of granularity | Date dimension at the end-of-period granularity | Multiple date dimensions |
Number of dimensions | More than periodic fact type | Fewer than transaction fact type | Highest number of dimensions when compared to other fact table types |
Conformed dimensions | Uses shared conformed dimensions | Uses shared conformed dimensions | Uses shared conformed dimensions |
Measures | Related to transaction activities | Related to periodic activities | Related to activities which have a definite lifetime |
Database size | Largest size. At the most detailed grain level, tends to grow very fast. | Smaller than the transaction fact table because the grain of the date and time dimension is significantly higher | Smallest in size when compared to the transaction and periodic fact tables |
Performance | Performs well and can be improved by choosing a grain above the most detailed | Performs better than other fact table types because data is stored at a less detailed grain | Performs well |
Insert | Yes | Yes | Yes |
Update | No | No | Yes, when a milestone is reached for a particular activity |
Delete | No | No | No |
Fact table growth | Very fast | Slow in comparison to transaction-based fact table | Slow in comparison to the transaction and periodic fact table |
Need for aggregate tables | High, primarily because the data is stored at a very detailed level | No or very low, primarily because the data is already stored at a high aggregated level | Medium, because the data is primarily stored at the day level. However, the data in accumulating fact tables is lower than the transaction level. |
GOSALESDW.SLS_SALES_FACT |
---|
ORDER_DAY_KEY |
ORGANIZATION_KEY |
EMPLOYEE_KEY |
RETAILER_KEY |
RETAILER_SITE_KEY |
PRODUCT_KEY |
PROMOTION_KEY |
ORDER_METHOD_KEY |
SALES_ORDER_KEY |
SHIP_DAY_KEY |
CLOSE_DAY_KEY |
QUANTITY |
UNIT_COST |
UNIT_PRICE |
UNIT_SALE_PRICE |
GROSS_MARGIN |
SALE_TOTAL |
GROSS_PROFIT |