UNIT-IV-MCA-305-ADVANCED DBMS
UNIT-IV-MCA-305-ADVANCED DBMS
• Optimization
• Evaluation
1.Parsing and Translation:-As query processing includes certain activities for
data retrieval. Initially, the given user queries get translated in high-level
database languages such as SQL. It gets translated into expressions that
can be further used at the physical level of the file system. After this, the
actual evaluation of the queries and a variety of query -optimizing
transformations and takes place. Thus before processing a query, a
computer system needs to translate the query into a human-readable and
understandable language.
• Optimization
• The cost of the query evaluation can vary for different types of queries. Although the system
is responsible for constructing the evaluation plan, the user does need not to write their
query efficiently.
• Usually, a database system generates an efficient query evaluation plan, which minimizes its
cost. This type of task performed by the database system and is known as Query
Optimization.
• For optimizing a query, the query optimizer should have an estimated cost analysis of each
operation. It is because the overall operation cost depends on the memory allocations to
several operations, execution costs, and so on.
• Evaluation
• In order to fully evaluate a query, the system needs to construct a query
evaluation plan.
• The annotations in the evaluation plan may refer to the algorithms to be used
for the particular index or the specific operations.
• Such relational algebra with annotations is referred to as Evaluation Primitives.
The evaluation primitives carry the instructions needed for the evaluation of
the operation.
• Thus, a query evaluation plan defines a sequence of primitive operations used
for evaluating a query. The query evaluation plan is also referred to as the
query execution plan.
• A query execution engine is responsible for generating the output of the given
query. It takes the query execution plan, executes it, and finally makes the
output for the user query.
Compensation and Databases Recovery
• Database Systems like any other computer system, are subject to failures
but the data stored in them must be available as and when required.
When a database fails it must possess the facilities for fast recovery. It
must also have atomicity i.e. either transactions are completed
successfully and committed (the effect is recorded permanently in the
database) or the transaction should have no effect on the database.
• There are mainly two types of recovery techniques used in DBMS
• Rollback/Undo Recovery Technique
• Commit/Redo Recovery Technique
• Rollback/Undo Recovery Technique:-
• The rollback/undo recovery technique is based on the principle of backing
out or undoing the effects of a transaction that has not been completed
successfully due to a system failure or error. This technique is
accomplished by undoing the changes made by the transaction using the
log records stored in the transaction log. The transaction log contains a
record of all the transactions that have been performed on the database.
The system uses the log records to undo the changes made by the failed
transaction and restore the database to its previous state.
• Commit/Redo Recovery Technique:-
• The commit/redo recovery technique is based on the principle of reapplying
the changes made by a transaction that has been completed successfully to
the database. This technique is accomplished by using the log records
stored in the transaction log to redo the changes made by the transaction
that was in progress at the time of the failure or error. The system uses the
log records to reapply the changes made by the transaction and restore the
database to its most recent consistent state.