Professional Documents
Culture Documents
I was absent…
Sorting: not much Important
1. Sorting may be requested by the query (e.g., order by) or is an important processing step for
other queries such as that involve a join.
2. If records are completely in main memory, standard sorting algorithms such as quick sort apply.
3. Otherwise, some records are still on disk, resulting in what is called external sorting.
Evaluation of expressions
1. The obvious way to evaluate an expression is simply to evaluate one operation at a time, in
appropriate order.
2. There are two general approaches while evaluating an expression which are:
a. Materialization:
i. In this method, the given expression evaluates one relational operation at a
time.
ii. Each operation in the expression is evaluated one by one in appropriate order
and result of each operation is materialized (or created) in a temporary relation
which becomes input for subsequent operation.
iii. E.g., πP Name, email-ID (σcatogery=Nobel)
iv. From above example, the relation created by selection on book relation will be
temporary relation and then join will be evaluated between temporary relation
and publisher relation which further gives another temporary relation.
v. By repeating the process, we evaluate the operation at root of the tree that
gives the final result.
vi. A disadvantage to this approach is the need to construct the temporary relation
which must be written.
vii. Cost:
1. Generally, the cost of evaluating an expression is the addition of cost of
all operations and cost of writing intermediate result to disk.
2. We assume that records of the result accumulate in a buffer and when
the buffer is full, they are written to the disk. [overall cost = sum of
individual operations + cost of writing intermediate results to disk]
viii. Double buffering: Use two output buffers for each operation, when one buffer
is full, write it to disk while the other is getting filled.
b. Pipelining
i. The problem with materialization is just that lots of temporary files, lots of Input
and Output.
ii. With pipeline evaluation, the operation formed from a queue and results are
passed from one operation to another as they are calculated. Hence, the
techniques name.
iii. Avoids write-outs of entire intermediate relations.
iv. This is an alternative approach used to evaluate several operations
simultaneously with the results of operations passed onto the next without the
need to store a temporary relation.
v. Consider the expression, πa1, a2 (r⨝s)
vi. In case of materialization, evaluation would involve creating temporary
relation to whole result of join and then read that result to perform
projection.
vii. But in case of pipelining, when the join operation generates a tuple of its
result, it passes that tuple immediately to project operation for processing.
By combining join and projection, we avoid creating intermediate results.
viii. Advantages
1. Reduces the cost of query evaluation by eliminating the cost of
reading and writing temporary relations.
2. It can start generating every result quickly, if a root operator of a
query evaluation plan is combined in a pipeline with its inputs.
Query Optimization
1. The process of selecting the most efficient query evaluation plan from among the many
strategies usually possible for processing a given query specially if the query is complex.
2. E.g., Relation Schema
Find the name of all instructors in the music department together with the course title of all the
courses that the instructor teaches.
Ans2 … … …
- Public key cryptography is an encryption technique that uses a paired public and private
(asymmetric) key for secured data communication
- A message sender uses recipients a public key to encrypt a message
- To decrypt the sender’s message, only the recipients private key may be used.