Korth, Silberschatzsu Darshan "Database Systems, Concepts" 5
Korth, Silberschatzsu Darshan "Database Systems, Concepts" 5
Korth, Silberschatzsu Darshan "Database Systems, Concepts" 5
: 1821008
Experiment No. 03
Grade: AA / AB / BB / BC / CC / CD /DD
______________________________________________________________________________
____
___________________________________________________________________________
_____
Pre Lab/ Prior Concepts: Database, ER diagram, Relation mapping, SQL
______________________________________________________________________________
______
K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Implementation Details:
Perform following;
1. Index tuning
Index tuning is part of database tuning for selecting and creating indexes. The index tuning
goal is to reduce the query processing time. Potential use of indexes in dynamic environments
with several ad-hoc queries in advance is a difficult task. Index tuning involves the queries based
on indexes and the indexes are created automatically on-the-fly. No explicit actions are needed by
the database users for index tuning.
Example 1:
Example 2:
Example 3:
As we can see above, after applying index tuning, It took less time for the same query to get
executed, and it also compares less number of rows.
2. Query Tuning
Sql Statements are used to retrieve data from the database. We can get same results by
writing different sql queries. But use of the best query is important when performance is
considered. So you need to sql query tuning based on the requirement. Here is the list of queries
which we use regularly and how these sql queries can be optimized for better performance.
Example 1:
Before Tuning
After Tuning-
By using * it takes longer time to execute the query and displays the output whereas using select
clause along with column names took less time which is more effective.
Example 2:
In the above query having clause takes longer time for execution along with where clause
whereas using only where clause displays the output much faster.
Example 3:
The cross joins produces the cross product or Cartesian product of two tables whereas the natural
join is based on all the columns having the same name and data types in both the tables
3. Database Tuning
1) Courier_service
2) payment
courier_service
shipping_info order_id
payment
payment_info order_id
By applying de-normalization
Courier_service
Payment
By applying join between courier_service and payment table we can display all tables when
required to display summary of particular order but by using de-normalization it can be reduced
of using join instead of using new table payment which consist of all info about payment and
courier service which is much effective in database tuning.
Conclusion:
Hence, here we have learnt about Index tuning which reduces the overall response and
running time of a query, Query Tuning which reduces overall running time when the
query is directly executed and the concept Database Tuning by doing de-normalization.
ANS-
Physical design is an activity where the goal is not only to create the appropriate
structuring of data in storage, but also to do so in a way that guarantees good
performance. For a given conceptual schema, there are many physical design alternatives
in a given DBMS. It is not possible to make meaningful physical design decisions and
performance analyses until the database designer knows the mix of queries, transactions,
and applications that are expected to run on the database. This is called the job mix for
the particular set of database system applications. The database administrators/designers
must analyze these applications, their expected frequencies of invocation, any timing
constraints on their execution speed, the expected frequency of update operations, and
any unique constraints on attributes. We discuss each of these factors next.
Before undertaking the physical database design, we must have a good idea of the
intended use of the database by defining in a high-level form the queries and
transactions that are expected to run on the database. For each retrieval query, the
following information about the query would be needed:
The files that will be accessed by the query. The attributes on which any selection
conditions for the query are specified. Whether the selection condition is equality,
inequality, or a range condition. The attributes on which any join conditions or conditions
to link multiple tables or objects for the query are specified. The attributes whose values
will be retrieved by the query. The attributes listed in items 2 and 4 above are candidates
for the definition of access structures, such as indexes, hash keys, or sorting of the file.
For each update operation or update transaction, the following information would be
needed:
The attributes on which selection conditions for a delete or update are specified.
Again, the attributes listed in item 3 are candidates for access structures on the files,
because they would be used to locate the records that will be updated or deleted. On the
other hand, the attributes listed in item 4 are candidates for avoiding an access structure,
since modifying them will require updating the access structures.
Some queries and transactions may have stringent performance constraints. For example,
a transaction may have the constraint that it should terminate within 5 seconds on 95
percent of the occasions when it is invoked, and that it should never take more than 20
seconds. Such timing constraints place further priorities on the attributes that are
candidates for access paths. The selection attributes used by queries and transactions with
time constraints become higher-priority candidates for primary access structures for the
files, because the primary access structures are generally the most efficient for locating
records in a file.
A minimum number of access paths should be specified for a file that is frequently
updated, because updating the access paths themselves slows down the update operations.
For example, if a file that has frequent record insertions has 10 indexes on 10 different
attributes, each of these indexes must be updated whenever a new record is inserted. The
overhead for updating 10 indexes can slow down the insert operations.
Access paths should be specified on all candidate key attributes—or sets of attributes—
that are either the primary key of a file or unique attributes. The existence of an index (or
other access path) makes it sufficient to only search the index when checking this
uniqueness constraint, since all values of the attribute will exist in the leaf nodes of the
index. For example, when inserting a new record, if a key attribute value of the new
Date: _____________