Establish referential relationships
For the database server to support the dimensional data model, you must define logical dependencies between the fact tables and their dimension tables.
- Fragment-key expressions
- Join conditions
- Query predicates for fragment elimination
A referential constraint enforces a one-to-one relationship between the values in referencing columns (of the foreign key) and the referenced columns (of the primary key or unique constraint). The relationship between the referenced table with the primary key constraint and the referencing table with the foreign key constraint is sometimes called a parent-child relationship. The corresponding columns of the parent and child tables can have the same identifiers, but having the same identifiers is not a requirement. There can also be a many-to-one relationship between the referencing table (with the foreign key) and the referenced table (with the primary key, or with the unique constraint).
In the dimensional model, a primary key constraint or a unique constraint in the fact table corresponds to a foreign key constraint in the dimension table. These constraints are specified in the CREATE TABLE or ALTER TABLE statements of SQL that defines the schema of the tables. Because the tables in the primary key and foreign key constraints must be in the same database, the database schema must include the dimension tables of each fact table.
The same data values can appear in the constrained columns of both tables. As a result, the index on which these referential constraints are defined can be used in queries as join predicates to join the fact table and the dimensional table.
For tables that are fragmented by expression or fragmented by list, you can use the foreign key
as the fragmentation key for the dimension tables. If you use the
foreign key as the fragmentation key, you can use the equality operator
or MATCHES operator with the primary key and foreign key values as
the join predicate in queries and other data manipulation operations.
The join predicate will be TRUE
for only a subset
of the fact table fragments. As a result, the query optimizer can
use fragment elimination to process only the fact table partitions
that contain qualifying rows.