Explain pipelining approach of evaluation of expression in detail.
Pipelining
In this method, DBMS does not store the records in temporary tables. Instead, it queries each query and the result of which will be passed to the next query to process and so on. It will process the query one after the other and each will use the result of the previous query for its processing. Pipelining evaluates multiple operations simultaneously by passing the results of one operation to the next one without storing the tuples on the disk.
In the example of figure 3.6, all three operations can be placed in a pipeline, which passes the results of the selection to the join as they are generated. In turn, it passes the results of the join to the projection as they are generated. The memory requirements are low since the results of an operation are not stored for long. However, as a result of pipelining, the inputs to the operations are not available all at once for processing.
Creating a pipeline of operations can provide two benefits:
- It eliminates the cost of reading and writing temporary relations, reducing the cost of query evaluation.
- It can start generating query results quickly if the root operator of a query evaluation plan is combined in a pipeline with its inputs. This can be quite useful if the results are displayed to a user as they are generated, since otherwise there may be a long delay before the user sees any query results.
Implementation of pipelining
1. Demand-driven (or Lazy evaluation) pipelining:
In this method, the result of lower-level queries is not passed to the higher level automatically. It will be passed to a higher level only when it is requested by the higher level. In this method, it retains the result value and state with it and it will be transferred to the next level only when it is requested.
2. Producer-driven (or Eager) pipelining:
In this method, the lower-level queries eagerly pass the results to higher-level queries. It does not wait for the higher-level queries to request the results. In this method, the lower-level query creates a buffer to store the results and the higher-level queries pull the results for its use. If the buffer is full, then the lower-level query waits for the higher-level query to empty it. Hence it is also called PULL and PUSH pipelining.
Comments
Post a Comment