This preview shows pages 1–9. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Bags Versus Sets Extended Operators Joins Extended Operators in SQL and Relational Algebra T. M. Murali September 15, 2010 T. M. Murali September 15, 2010 Extended Operators in SQL and Relational Algebra Bags Versus Sets Extended Operators Joins Bags or Sets? I So far, we have said that relational algebra and SQL operate on relations that are sets of tuples. I Real RDBMSs treat relations as bags of tuples. I A tuple can appear multiple times in a relation. T. M. Murali September 15, 2010 Extended Operators in SQL and Relational Algebra Bags Versus Sets Extended Operators Joins Bags or Sets? I So far, we have said that relational algebra and SQL operate on relations that are sets of tuples. I Real RDBMSs treat relations as bags of tuples. I A tuple can appear multiple times in a relation. I Performance is one of the main reasons; T. M. Murali September 15, 2010 Extended Operators in SQL and Relational Algebra Bags Versus Sets Extended Operators Joins Bags or Sets? I So far, we have said that relational algebra and SQL operate on relations that are sets of tuples. I Real RDBMSs treat relations as bags of tuples. I A tuple can appear multiple times in a relation. I Performance is one of the main reasons; duplicate elimination is expensive since it requires sorting. I If we use bag semantics, we may have to redefine the meaning of each relation algebra operator. T. M. Murali September 15, 2010 Extended Operators in SQL and Relational Algebra Bags Versus Sets Extended Operators Joins Bag Semantics: Projection and Selection I Projection ( ()): process each tuple independently; a tuple may appear in the resulting relation multiple times. I Selection ( ()): process each tuple independently; a tuple may appear in the resulting relation multiple times. T. M. Murali September 15, 2010 Extended Operators in SQL and Relational Algebra Bags Versus Sets Extended Operators Joins Bag Semantics: Projection and Selection I Projection ( ()): process each tuple independently; a tuple may appear in the resulting relation multiple times. I Selection ( ()): process each tuple independently; a tuple may appear in the resulting relation multiple times. R A B C 1 2 3 1 2 4 2 3 4 2 3 4 T. M. Murali September 15, 2010 Extended Operators in SQL and Relational Algebra Bags Versus Sets Extended Operators Joins Bag Semantics: Projection and Selection I Projection ( ()): process each tuple independently; a tuple may appear in the resulting relation multiple times. I Selection ( ()): process each tuple independently; a tuple may appear in the resulting relation multiple times. R A B C 1 2 3 1 2 4 2 3 4 2 3 4 A , B (R) T. M. Murali September 15, 2010 Extended Operators in SQL and Relational Algebra Bags Versus Sets Extended Operators Joins Bag Semantics: Projection and Selection I Projection ( ()): process each tuple independently; a tuple may appear in the resulting relation multiple times....
View Full
Document
 Fall '08
 CMMALIK

Click to edit the document details