Database_Performance_Tuning_and_Query_Op
Database_Performance_Tuning_and_Query_Op
1 Introduction
The goal of database performance tuning is to minimize the response time of queries by
making the best use of system resources. The best use of these resources involves
minimizing network traffic, disk I/O, and CPU time. This goal can only be achieved by
understanding the logical and physical structure of data, the applications used on
system, and how the conflicting uses of database might affect performance. Although
newer relational databases and faster hardware run most SQL queries with a signifi-
cantly small response time, there is always room for improvement. SQL performance
tuning can be an incredibly difficult task, particularly when working with large- scale
data where even the most minor change can have a dramatic - positive or negative
impact on performance. Since most relational databases share same design concepts
under their hood, this paper is not specific to any particular vendor. Although in our
example we talk about five databases, these tips apply to a wider range of RDBMS.
Database Management System (DBMS) is the main source of any Organization,
Institute or Company to run their business. One of the core value of any organization is
customer centricity, performance tuning is highly desirable and Customers’ needs to be
satisfied. Database performance tuning encompasses the steps one can take to optimize
performance with the goal of maximizing the use of system resources for greater
efficiency [1–4]. By fine- tuning certain database elements such as index use, query
structure, data models system configuration (e.g., hardware and OS settings) and
application design, one can significantly impact the overall performance of application
[5–8].
2 Performance Tuning
Database Tuning is the activity of making a database application run more quickly.
“More quickly” usually means higher throughput, though it may mean lower response
time for time-critical applications. 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 [9].
One can then tune these queries and the underlying indexes to resolve the CPU
bottleneck. Also, configure SQL Server to use all available CPU machines. One can
also scale up SQL Server system by adding additional CPUs or upgrading to a new
server with more and faster CPUs.
• Memory Structures
Memory affects SQL Server performance more than any other piece of hardware.
Therefore, it is necessary to monitor memory usage regularly on SQL Server systems to
ensure that the percentage of memory available is higher than 20%. If users are
experiencing performance issues and the percentage of available memory drops below
20%, then the problem is insufficient memory allocation. Observe the average page life
expectancy performance counter and make sure it is always above 300 s (5 min).
Anything less indicates either poor index design leading to increased disk input/output
(I/O) and less effective use of memory or an actual shortage of memory. Monitor the
paging rates on the SQL Server system, and make sure they are regularly above 1,000
pages per second. Typically, small OLTP transactions do not require large memory
grants. Anything greater than a memory grant of zero for an OLTP transaction indicates
low memory in a SQL Server system [12].
One way to handle memory bottlenecks is to find memory-intensive processes,
which can be used to identify potential application problems such as memory leaks.
One can also review queries to optimize performance to consume less memory.
Another approach is to scale up the SQL Server environment by adding more physical
6 S. J. Kamatkar et al.
memory (RAM) to the SQL Server. Scaling up is usually a good approach to address
any performance bottleneck related to memory.
• I/O Capacity issue
Compared to other hardware resources, storage input/output is usually the slowest
of the system resources in SQL Server. Therefore, it is essential to investigate whether
one can optimize the design and configuration of the storage system to achieve scal-
ability and high performance, disk counters for Average Disk Sec/Read and Average
Disk.
Sec/Write. Make sure that the time a read or write takes is, ideally, less than 12 ms
for OLTP systems and higher for decision support systems.
As with memory, the easiest way to solve a disk I/O performance bottleneck is to
scale up the SQL Server environment by replacing existing disks with faster disks that
can better cope with the I/O load and that distribute the I/O load across multiple
spindles. Also, defragment the data disk regularly [13, 14].
• Database Design issues
Poor database design leads to inadequate database performance. For example, the
highly normalized database is associated with complex relational joins. This result in
long-running queries that waste system resources such as CPU, memory and disk I/O.
Thus a highly normalized database degrades SQL Server and database performance
significantly. The general rule for writing efficient queries is to redesign the database if
any operation requires five or more table joins.
• Indexing Issues
Indexes are the solution to many performance problems, but having too many
indexes on frequently updated tables can incur additional overhead because SQL
Server performs extra work to keep indexes up-to-date during insert/update/delete
operations. Thus the SQL Server database engine needs more time when updating data
in the table based on the number and complexity of the indexes. Also, index mainte-
nance can increase CPU and I/O usage, which can be harmful to performance in a
write-intensive system. One has to remove any duplicate and redundant indexes as they
are a draining the system resources.
3 Query Optimization
Query optimization is the overall process of choosing the most efficient means of
executing a SQL statement.
SQL is a nonprocedural language, so the optimizer is free to merge, reorganize, and
process in any order. The database optimizes each SQL statement based on statistics
collected about the accessed data. The following are the causes for bottlenecks [18].
3.1 Causes
CPU Bottlenecks, database upgrade issue, database configuration issue, poor database
design, large table, indexing issue, key issue, unmanaged complex query, bad coding,
and data loads consuming lots of resources and time.
Mumbai University has many more application with large Database and Applications.
Like “Employee Biometric Attendance Management System”. The Database of this
system stores the large amount of Employee attendance data and Leave Application
data. We generate many reports such as monthly report of “Employee Attendance
Statistics Report” (Fig. 4). In this Report the following are required fields: employee
code; employee name department name designation; total working days’ total present
days early going; late coming; total working hours and total leave taken.
4.1 Challenges
The BioHRM database has 90 tables which are inter related to each other. Those Tables
have large amount of employees’ attendance and leave application data. And BioHRM
System has categories into two category one is Teaching Staff (Total staff-230) and
another is Non-Teaching Staff (Total staff-1140). Writing the query to get employee
attendance statistics with their respective leaves taken in that particular month becomes
complex. It’s taking more time to produce or generate reports and consume lots of
resources.
To overcome the above challenges, we have tried to overcome the causes of bot-
tleneck and optimize the query execution techniques (Fig. 3).
5 Conclusion
References
1. Oracle: Oracle Database Administrator’s Guide 11 g Release 2 (11.2) (2013)
2. Shasha, D.: Tuning databases for high performance. AMC Comput. Surv. Baltimore 28
3. Groff, J.R., Weinberg, P.N.: SQL: The Complete Reference, Second Edition
4. Choudhuri, S., Narasayya, V.: Self-tuning database systems: a decade progress. Microsoft
Research (2007)
5. Satish, S.K., Saraswatipura, M.K., Shastry, S.C.: DB2 performance enhancements using
materialized query table for LUW systems. In: ICONS 2007 Second International
Conference, April 2007
6. Wiese, D., Rabinovitch, G.: Knowledge Management in autonomic database performance
tuning, 20–25 April 2009
7. Zhang, G., Chen, M., Liu, L.: A model for application–oriented database performance tuning
8. Rupley Jr., M.L.: Introduction to Query Processing and Optimization. Indiana University at
South Bend (2008)
9. Agarwal, S., Bruno, N., Chaudhari, S.: AutoAdmin: self tuning database system technology.
IEEE Data Eng. Bull. (2006)
10. Auto Admin: Self-Tuning database systems technology. IEEE (2006)
11. SQL Memory Management in Oracle9i, Hong Kong, China (2002)
12. Foundations of Automated Database Tuning. In: VLDB 2006, Seoul, Korea, VLDB
Endowment. ACM, 12–15 September 2006
13. Burleson, D.: Oracle Tuning, The Definitive Reference Second Edition
14. Bruno, N., Chaudhuri, S.: Exploiting statistics on query expressions for optimization. In:
Proceedings of ACMSIGMOD Conference. ACM (2002)
15. Top 10 performance tuning tips for relational databases. http://web.synametrics.com/
top10performancetips.htm
16. SQL Server Optimization Tips (2017). http://santhoshgudise.weebly.com/uploads/8/5/4/7/
8547208/sql_server_optimization_tips-1.doc
17. Farooq, B.: Five tips to avoid a performance bottleneck or other SQL Server snares. http://
searchsqlserver.techtarget.com/tip/Five-tips-to-avoid-a-performance-bottleneck-or-other-
SQL-Server-snares
18. Viloria, A., Robayo, P.V.: Virtual network level of application composed IP networks
connected with systems-(NETS Peer-to-Peer). Indian J. Sci. Technol. 9(46) (2016)