Develop cost functions for the PROJECT, UNION, INTERSECTION, SET DIFFERENCE, and CARTESIAN PRODUCT algorithms discussed in section 19.4.
What will be an ideal response?
Assume relations R and S are stored in b R and b S disk blocks, respectively. Also, assume
that the file resulting from the operation is stored in b RESULT disk blocks (if the size
cannot be otherwise determined).
PROJECT operation: if
read–in and write–out files have the same size, which is the size of R itself; if
eliminating duplicates, which costs another scan; thus the latter cost is 3*b R +
k*b R *log 2 b R (assuming PROJECT is implemented by sort and eliminate duplicates).
SET OPERATIONS (UNION, DIFFERENCE, INTERSECTION): According to the algorithms
where the usual sort and scan/merge of each table is done, the cost of any of these is:
k*[(b R *log 2 b R ) + (b S *log 2 b S )] + b R + b S + b RESULT
CARTESIAN PRODUCT: The join selectivity of Cartesian product is js = 1, and the typical
way of doing it is the nested loop method, since there are no conditions to match. We first
assume two memory buffers; the other quantities are as discussed for the JOIN analysis
in Section 18.2.3. We get:
J1: C R X S = b R + (b R *b S ) + (|R|*|S|)/bfr RS
Next, suppose we have n B memory buffers, as in Section 16.1.2. Assume file R is
smaller and is used in the outer loop. We get:
J1': C R X S = b R + ceiling(b R /(n B - 1)) * b S )+ (|R|*|S|)/bfr RS , which is better than
J1, per its middle term.
You might also like to view...
List all guests currently staying at the Grosvenor Hotel.
What will be an ideal response?
The Zoom and Hand tools can be used to increase or decrease the size of the objects in your document.
Answer the following statement true (T) or false (F)
To select multiple entries in a list, press the ____ key as you click each additional entry.
A. Shift B. Esc C. F4 D. Ctrl
The process of an ISATAP host communicating with an IPv6 node on an IPv6-capable subnet involves two different connections: a connection between the ISATAP router and the IPv6-capable subnet and which of the following?
A. a router-to-host connection through an ISATAP proxy B. an ISATAP gateway connection through the ISATAP tunnel C. a host-to-host tunnel from the ISATAP router to the non-ISATAP router D. a host-to-router tunnel from the ISATAP node to the ISATAP router