99 106 Histogram to estimate result set of σ A cR If a histogram is available

99 106 histogram to estimate result set of σ a cr if

This preview shows page 99 - 106 out of 106 pages.

99 / 106
Image of page 99
Histogram to estimate result set of σ A = c (R) If a histogram is available for the attribute A , the number of tuples can be estimated with more accuracy. The range in which the value c belongs is first located in the histogram . |B| : number of values per bucket (# distinct values appearing in that range) #B : number of records in bucket T ( σ A = c (R) ) = # B | B | 100 / 106
Image of page 100
Histogram to estimate result set of σ A = c (R) Example R(A,B,C) is a relation. T(R) = 10,000 V(R,A) = 50 Estimate T ( σ A =10 (R) ) The DBMS has collected the following equi-width histogram on A range [1,10] [11,20] [21,30] [31,40] [41,50] tuples in range 50 2000 2000 3000 2950 T ( σ A =10 (R) ) = # B | B | = 50 10 = 5 101 / 106
Image of page 101
Join Size using Histograms R 1 S Use: T(R 1 S) = T(R) × T(S) max ( V(R,A),V(S,A) ) Apply for each bucket 102 / 106
Image of page 102
Join Size using Histograms V(R,A) = V(R,A) = bucket size |B| T(R 1 S) = buckets #B(R) × #B(S) |B| 103 / 106
Image of page 103
Advanced Techniques Wavelets Approximate Histograms Sampling Techniques Compressed Histograms 104 / 106
Image of page 104
Summary As should be clear by now, result size estimation is not an exact art To estimate the size of the intermediate relations, we have used parameters like T(R) and V(R,A) The DBMS keeps statistics from previous operations to be able to provide such parameters However, computing statistics are expensive and should be recomputed periodically only: statistics usually have few changes over a short time even inaccurate statistics are useful statistics recomputation might be triggered after some period of time or after some number of updates 105 / 106
Image of page 105
Outline Estimating cost of query plan Estimating size of results Estimating # of IOs (next) Operator Implementations Generate and compare plans 106 / 106
Image of page 106

You've reached the end of your free preview.

Want to read all 106 pages?

  • Fall '19
  • Joseph Rosen
  • Relational model, StarsIn, R 1c S

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

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes