Database Management Systems
Database Management Systems
Management Systems
(CAMI13)
Assessment - 4
BTECH - IV Semester
1|Page
Contents
_____________________________________
Sl. No. Topic Page No.
Database Design in Relational 3
1. Databases
An Overview of Database 8 - 12
6. Tuning in Relational systems
a. Tuning Indexes 12 - 13
b. Tuning the Database Design 13 - 15
c. Tuning Queries 15 - 16
d. More Guidelines for Query 16 - 18
Tuning
7. Conclusion 18 - 19
2|Page
8. References 19
3|Page
Physical database design is a procedure that includes converting a
data model into the physical data structure of a database management
system (DBMS). Physical Design is a multi-step process, in which a
business model is expanded into a fully attributed model (FAM), followed
by its transformation into a physical design model.
4|Page
with time constraints become higher-priority candidates for primary
access structure.
5|Page
2. What attribute(s) to index on? Single or several attributes (called
composite index) may be used for indexing on. A composite index is
necessarily required in case multiple attributes from one relation are
involved together in more than one queries.
4. Whether to use a hash index over a tree index? B+-trees for indexing
are prevalent in RDMSs as they support equality and range queries
on the search key attribute. Hash indexes are used in ISAM and other
systems as they perform better with equality conditions especially when
finding a matching record(s) using joins.
6|Page
Figure 3: A Diagram of B+ tree
5. Whether to use dynamic hashing for the file? Dynamic hashing is most
suitable for highly volatile/changing files that frequently grow or shrink
in size.
Creating an Index:
_____________________________________
The general syntax common to several RDBMSs is:
[CLUSTER];
7|Page
Denormalization as a Design Decision for
Expediting Queries:
_____________________________________
The drawback is that in large tables, an unnecessarily long time may be spent
in implementing joins on those tables. Therefore, under denormalization, a
trade-off is accepted between some redundancy and a little extra effort
to update the database for maintaining consistency of redundant
attributes versus the efficiency advantages of incorporating as few costly
joins as possible in a relational database.
8|Page
Figure 5: Various Normal Forms and their Distinctions
9|Page
design parameters that were discussed earlier and it is nothing but a
continuous optimization or refinement of the overall physical design.
Figure 6: Knowledge required about the various levels for efficient Tuning
The aspects of physical design are revisited and the actual statistics about
usage patterns (frequency of invoking certain queries and transactions,
frequency of updating operations and time constraints) are gathered while
implementation of the application making use of the database. Hence, the
process of continuously revising or adjusting the physical database
design by monitoring resource utilization and internal DBMS processing
to locate bottlenecks such as contention for the same data or devices is
called database tuning.
10 | P a g e
Figure 7: Database Tuning as a Process
The collected input parameters to the tuning process heavily rely upon data
statistics gathered from various sources such as:
11 | P a g e
2. I/O and device performance statistics – Total amount of
read/write activity on disk extents and disk hot spots.
3. Query/transaction processing statistics - Execution and
optimization times of queries and transactions.
4. Locking/logging related statistics - Rates of different types of
locks issued, transaction throughput rates and log records activity.
5. Index statistics - Number of levels in an index or number of non-
contiguous leaf pages etc.
12 | P a g e
2. To minimize the overhead of logging and unnecessary dumping of
data.
3. To optimize the buffer size and scheduling of processes.
4. To allocate resources such as disks, RAM, and processes for most
efficient utilization.
Tuning Indexes
_____________________________________
After analysing the data statistics conveying insight into the usage pattern of
the application and its database, one may come across certain bottlenecks
slowing down the data throughput for queries, transactions or views. Some
of these bottlenecks may be easily dissolved by revisiting the choice of
indexes to improve upon the performance.
Figure 9: Architecture of
Index Selection Tool
13 | P a g e
Such possible problems may be traced by an in-built command or facility of
the Database Management System used. These systems maintain a log or a
record book to note down the sequence of queries executed, operations
performed in a particular order and the indexes used. The cause of a
bottleneck may be diagnosed by going through these records and an
appropriate index may be created, modified or deleted.
Following are few of the options that can be implemented to tune indexes:
Here are the possible changes that can be made to the Database Design:
1. A table may be split into two with a duplicated copy of the key
attribute to reduce the number of total number of attributes in
each when queries about any two attributes occur with high
frequencies. In that case, separation of tables may result in increased
efficiency. Mathematically, a relation of the form R(K, A, B, C, D, …)
that is in BCNF can be stored into multiple tables, for example R1(K,
A, B), R2(K, C, D, ), R3(K, ...)—that are also in BCNF by replicating
the key K in each table. This process is referred to as vertical
partitioning as it splits a table vertically into multiple tables.
14 | P a g e
2. Horizontal partitioning may be used as well, in case of data
comprising a large number of records. True to its name as the vertical
partitioning, horizontal partitioning splits the table into horizontal
slices and stores them as different tables with the same set of
columns (attributes) but containing a distinct set of tuples. In case
a query or transaction needs to be made on all the records, it will have
to be run against all the results to obtain a combined result.
15 | P a g e
4. The normalization level from Boyce-Codd Normal Form to 3NF, 2NF
or 1NF may be reduced by joining (denormalizing) the existing tables
because certain attributes from two or more tables are frequently
accessed together.
Tuning Queries
_____________________________________
The need for tuning queries may arise due to a number of situations. For
example, if too many disk accesses issues crop up or the plan of query
(log maintained by the Database management System) reveals that
relevant or intended indexes are not being used while processing data.
Sometimes, the DBMS may not be executing the plan originally thought of.
Common areas of weakness include:
16 | P a g e
o Selections involving null values.
o Selections involving arithmetic or string expressions.
o Selections involving OR conditions.
o Lack of evaluation features like index-only strategies, certain join
methods or poor size estimation.
Below listed are some of the typical situations in which tuning query proves
to be more effective than other methods:
17 | P a g e
Figure 11: Use of BETWEEN operator is recommended. It allows the optimizer
to recognize both parts of the range selection.
If an equality join is set up between two tables, the range predicate on the
joining attribute set up in one table may be repeated for the other table.
18 | P a g e
Figure 12: Optimized query block eliminating HAVING and GROUP BY
Conclusion
_____________________________________
The process of Database design involves several tasks such as
requirements analysis, conceptual design, schema refinement, physical
design, and tuning. Generally, one needs to go back and forth between
these tasks to refine a database design, and it may be observed that decisions
in one task can influence the choices in another task. Developing a good
design is heavily dependent on understanding the nature of the workload for
the application, and the performance goals for which clearly defining the
important queries and updates or involved attributes/relations ais extremely
essential.
19 | P a g e
In query expressions, null values, arithmetic conditions, string
expressions, the use of ORs, etc. may confuse an optimizer. That may
require the query/view to be rewritten while making sure components such
as nested queries, temporary relations, complex conditions, and operations
like DISTINCT and GROUP BY are avoided.
References
_____________________________________
Books:
Fundamentals of Database Systems, 5th Edition, 2007, Ramez Elmasri
and Shamkat B. Navathe, Chapter-16: Practical Database Design and
Tuning
Database System Concepts, 6th Edition, Abraham Silberschatz (Yale
University), Henry F. Korth (Lehigh University), S. Sudarshan (IIT,
Bombay), Part Two: Database Design
An Introduction to Database Systems, 8th Edition, C. J. Date, Part III:
Database Design.
Websites/Hyperlinks:
Database Management Systems by R. Ramakrishnan, Database Tuning,
Module 5, lectures 6 and 7
http://pages.cs.wisc.edu/~dbbook/openAccess/firstEdition/slides/pdfslide
s/mod5l6-7.pdf
https://www.slideshare.net/hhhchamp/physical-database-design-
performance
https://www.studocu.com/en-au/document/charles-sturt-
university/database-management-systems/lecture-notes/chapter-20-
physical-database-design-and-tuning/4448391/view
http://pages.di.unipi.it/ghelli/bd2/11.physicaldesign.pdf
http://www.csbio.unc.edu/mcmillan/Media/Comp521F10Lecture20.pdf
20 | P a g e