Relational Algebra for Query Optimisation - PowerPoint PPT Presentation

About This Presentation
Title:

Relational Algebra for Query Optimisation

Description:

1. Relational Algebra for Query Optimisation. The axioms of relational algebra. 11/13/09 ... LAWS OF RELATIONAL ALGEBRA 1. 1. Commutativity of joins and product ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 7
Provided by: meurig
Category:

less

Transcript and Presenter's Notes

Title: Relational Algebra for Query Optimisation


1
Relational Algebra for Query Optimisation
  • The axioms of relational algebra

2
LAWS OF RELATIONAL ALGEBRA 1
  • 1. Commutativity of joins and product
  • If denotes any type of join or product, then
    EFº FE.
  • 2. Associativity for joins and products
  • If denotes any type of join or product,
    then (E F) G º E (F G).
  • 3. Cascade of projections/selections
  • PA1 ... An (PB1 ... Bm (E)) º PA1 ... An (E)
  • whenever B1,, Bm Ê A1,..., An
  • sF1 Ù F2 (E) º sF1 (sF2 (E)).
  • Consequence Selection is commutative.

3
LAWS OF RELATIONAL ALGEBRA 2
  • 4. Commuting selections and projections
  • PA1 ... An (sF (E)) º sF (PA1 ... An (E))
  • provided that condition F depends only on A1
    ,..., An.
  • More generally
  • PA1 ... An (sF (E)) º PA1 ... An (sF (PA1 ... An
    B1 ... Bm (E)))
  • 5. Commuting selection with Cartesian product
  • sF(E1 E2) º sF(E1) E2
  • if F involves only attributes of E1

4
LAWS OF RELATIONAL ALGEBRA 3
  • 5. Commuting selection with Cartesian product
  • sF(E1 E2) º sF(E1) E2
  • if F involves only attributes of E1
  • Corollary to law 5
  • If F F1 Ù F2, where F1 and F2 involve
    attributes of E1 and E2, then sF(E1 E2) º
    sF1(E1) sF2(E2)
  • If F1 involves only attributes of E1 and F2
    involves both attributes of E1 and E2 then
  • sF(E1 E2) º sF2(sF1(E1) E2)

5
LAWS OF RELATIONAL ALGEBRA 4
  • 6. Commuting selection with a union.
  • Assume (for well-defined union) that E1, E2 and
  • E1 È E2 have the same attributes. Then
  • sF(E1 È E2) º sF(E1) È sF(E2)
  • 7. Commuting selection with a difference
  • sF(E1 - E2) º sF(E1) - sF(E2)
  • Rules above suffice for describing relationship
    between selections and joins, since a join is
    expressible in terms of Cartesian product,
    selection and (if it is a natural join) a
    projection.

6
LAWS OF RELATIONAL ALGEBRA 5
  • 8. Commuting projection with Cartesian product
  • PA1 ... An (E1 E2) º PB1 ... Bm (E1) PC1
    ... Ck (E2)
  • where A B È C is a disjoint union, and
  • B are attributes of E1, and C attributes of
    E2.
  • 9. Commuting projection with union
  • PA1 ... An(E1 È E2) º PA1 ... An (E1) È PA1 ...
    An ( E2)
Write a Comment
User Comments (0)
About PowerShow.com