Databases Reference
In-Depth Information
Let's now use an inequality operator and try to find the records with a ProductID less
than 714. Since this requires all the records, both inside the range of a step and the upper
boundary, we need to calculate the sum of the values of both the RANGE_ROWS and the
EQ_ROWS columns for steps 1 through 7 as shown in the histogram below, which give us a
total of 13,223 rows.
RANGE_HI_KEY RANGE_ROWS EQ_ROWS DISTINCT_RANGE_ROWS AVG_RANGE_ROWS
------------ ---------- ------- ------------------- --------------
707 0 3083 0 1
708 0 3007 0 1
709 0 188 0 1
710 0 44 0 1
711 0 3090 0 1
712 0 3382 0 1
713 0 429 0 1
714 0 1218 0 1
715 0 1635 0 1
Listing 3-16.
This is the query in question, and the estimated number of rows is shown on the
execution plan in Figure 3-6.
SELECT * FROM Sales . SalesOrderDetail
WHERE ProductID < 714
Listing 3-17.
Search WWH ::




Custom Search