Description
A functional dependency is a relationship between two attributes in the same database.
If an attribute determines another attribute, we will call it a determinant, and the determined attribute is functionally dependent on the determinant.
We will denote the relationship with
For example, given a SQL:
select a, a+1 as b from t;
Here the attribute a
is a determinant of b
because b
is derived from a
. Thus we can get a functional dependency
Functional dependency is helpful in query optimization, with it we can eliminate outer joins, eliminate useless DISTINCT
, eliminate cross joins and etc.
Reference wiki and the thesis for more details.
The functional dependencies can be derived from relational operators, so it's possible to encapsulate them into RelationalProperty
.