{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

qp_overview - CPS216 Data-Intensive Computing Systems...

Info icon This preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
CPS216: Data-Intensive Computing Systems Introduction to Query Processing Shivnath Babu
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Query Processing Declarative SQL Query Query Plan Focus: Relational System (i.e., data is organized as tables, or relations) NOTE: You will not be tested on how well you know SQL. Understanding the SQL introduced in class will be sufficient (a primer follows). SQL is described in Chapter 6, GMUW.
Image of page 2
SQL Primer Select <attribute list> From <relation list> Where <condition list> Example Filter Query over R(A,B,C): Select B From R Where R.A = “c” R.C > 10 We will focus on SPJ, or Select-Project-Join Queries
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
SQL Primer (contd.) Select <attribute list> From <relation list> Where <condition list> Example Join Query over R(A,B,C) and S(C,D,E): Select B, D From R, S Where R.A = “c” S.E = 2 R.C = S.C We will focus on SPJ, or Select-Project-Join-Queries
Image of page 4
R A B C S C D E a 1 10 10 x 2 b 1 20 20 y 2 c 2 10 30 z 2 d 2 35 40 x 1 e 3 45 50 y 3 Answer B D 2 x Select B,D From R,S Where R.A = “c” S.E = 2 R.C=S.C
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
How do we execute this query? - Do Cartesian product - Select tuples - Do projection One idea Select B,D From R,S Where R.A = “c” S.E = 2 R.C=S.C
Image of page 6
R X S R.A R.B R.C S.C S.D S.E a 1 10 10 x 2 a 1 10 20 y 2 . . c 2 10 10 x 2 . . Bingo! Got one... Select B,D From R,S Where R.A = “c” S.E = 2 R.C=S.C
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Relational Algebra - can be used to describe plans Ex: Plan I Π B,D σ R.A =“c” S.E=2 R.C=S.C X R S
Image of page 8
Relational Algebra Primer (Chapter 5, GMUW) Select: σ R.A =“c” R.C=10 Project: Π B,D Cartesian Product: R X S Natural Join: R S
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Relational Algebra - can be used to describe plans Ex: Plan I Π B,D σ R.A =“c” S.E=2 R.C=S.C X R S OR: Π B,D [ σ R.A=“c” S.E=2 R.C = S.C (RXS)]
Image of page 10
Another idea: Π B,D σ R.A = “c” σ S.E = 2 R(A,B,C) S(C,D,E) Plan II natural join Select B,D From R,S Where R.A = “c” S.E = 2 R.C=S.C
Image of page 11

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
   R         S A  B  C σ ( R ) σ ( S )      C  D  E a  1  10        A   B  C       C  D  E     10  x  2 b  1  20 c   2  10     10  x  2     20  y  2 c  2  10        20  y  2     30  z  2 d  2  35        30  z  2     40  x  1 e  3  45                                         50  y  3 Select B,D From R,S Where R.A = “c” S.E = 2 R.C=S.C
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern