In relational database design, Attribute Closure is a technique used to find all attributes that can be determined from a given set of attributes using a set of functional dependencies. It is denoted as X+X^+ and is read as “the closure of XX”.

Attribute closure is very useful for:

  • Finding candidate keys and super keys from a given set of functional dependencies.

  • Verifying whether a functional dependency XYX \to Y logically follows from a given set of FDs.

What is Attribute Closure?

For a relation schema and a set of functional dependencies FF:

  • The attribute closure of XX, written X+X^+, is the set of all attributes that can be functionally determined by XX using the FDs in FF.

  • In practice, you start with XX and repeatedly apply FDs to add more attributes as long as new attributes can be determined.

Algorithm to Compute Attribute Closure

Given a set of functional dependencies FF and an attribute set XX:

  1. Initialize X+=XX^+ = X.

  2. For each functional dependency ABA \to B in FF:

    • If AX+A \subseteq X^+, then add BB to X+X^+.

  3. Repeat step 2 until no more attributes can be added to X+X^+.

The final result is X+X^+, the attribute closure of XX.

Example of Attribute Closure

Consider a relation R(A,B,C,D)R(A, B, C, D) with functional dependencies:

  • ABA \to B

  • BCB \to C

  • CDC \to D

Find A+A^+.

  1. Start with: A+={A}A^+ = \{A\}.

  2. ABA \to B and AA+A \subseteq A^+ ⇒ add BB:

    • A+={A,B}A^+ = \{A, B\}.

  3. BCB \to C and BA+B \subseteq A^+ ⇒ add CC:

    • A+={A,B,C}A^+ = \{A, B, C\}.

  4. CDC \to D and CA+C \subseteq A^+ ⇒ add DD:

    • A+={A,B,C,D}A^+ = \{A, B, C, D\}.

So A+={A,B,C,D}A^+ = \{A, B, C, D\}. This means AA is a super key for this relation.

Using Attribute Closure to Check Functional Dependencies

To check whether a functional dependency XYX \to Y follows from a set of FDs FF:

  1. Compute X+X^+.

  2. If YX+Y \subseteq X^+, then XYX \to Y holds.

If X+X^+ contains all the attributes of the relation, then XX is a super key.

Why Attribute Closure Matters in Design?

  • It helps identify candidate keys from a set of functional dependencies.

  • It supports normalization by clarifying which attributes determine others.

  • It is used in dependency preservation and lossless decomposition algorithms.

Summary

Attribute Closure in DBMS is the process of finding all attributes that can be functionally determined by a given set of attributes using the given functional dependencies. It is denoted as X+X^+ and is a fundamental tool for finding super keys, verifying FDs, and supporting normalization in relational database design.