SlideShare a Scribd company logo
1 of 22
CHAPTER 11:
DATABASE PERFORMANCE
TUNING AND QUERY
OPTIMIZATION
Jonathan Weinberg
Andrew Casteen
OBJECTIVES
 Basic database performance-tuning concepts
 How a DBMS processes SQL queries
 About the importance of indexes in query processing
 About the types of decisions the query optimizer has to make
 Some common practices used to write efficient SQL code
 How to formulate queries and tune the DBMS for optimal
performance
DATABASE PERFORMANCE-
TUNING CONCEPTS
 Goal of database performance is to execute queries as fast as possible
 Database performance tuning
• Set of activities and procedures designed to reduce response time of
database system
 All factors must operate at optimum level with minimal bottlenecks
 Good database performance starts with good database design (you
can't polish a turd)
PERFORMANCE TUNING:
CLIENT AND SERVER
 Client side
• Generate a SQL query that returns the correct answer in the least amount
of time
• Using the minimum amount of resources at the server end
• SQL performance tuning – The activities required to achieve that goal
 Server side
• DBMS environment configured to respond to the clients’ requests as fast
as possible
• Optimum use of existing resources
• DBMS performance tuning – The activities required to achieve that
goal
DBMS ARCHITECTURE
 All data in database are stored in data files
 Data files
• Can automatically expand in predefined increments known as
extends
• Grouped in file groups or table spaces
 Table space or file group
• Logical grouping of several data files that store data with similar
characteristics
DBMS ARCHITECTURE
CONT.
 Data cache or buffer cache
• Shared, reserved memory area that stores the most recently accessed
data blocks in RAM
 SQL cache or procedure cache
• Shared, reserved memory area that stores the most recently executed
SQL statements or PL/SQL procedures, including triggers and
functions
 DBMS retrieves data from permanent storage and places it in
RAM
DBMS ARCHITECTURE
CONT.
 Input/output (I/O) request: low-level data access operation to and
from computer devices
 Data cache is faster than data in data files because the DBMS does not
wait for hard disk to retrieve data
 Majority of performance-tuning activities focus on minimizing the
number of I/O operations
 Typical DBMS processes:
• Listener, user, scheduler, lock manager, optimizer
DBMS PROCESSES
 Listener: Takes clients’ requests and handles the processing
of the SQL requests to other DBMS processes. Once
received, the request is passes to appropriate user process
 User: Created to manage each client session and handles all
requests submitted to the server
 Scheduler: Organizes the concurrent execution of SQL requests
DBMS PROCESSES CONT.
 Lock Manager: Manages all locks placed on database objects
 Optimizer: Analyzes SQL queries and finds the most efficient way
to access the data
DATABASE STATISTICS
 Number of measurements about database objects and available
resources:
• Number of processors used
• Processor speed
• Temporary space available
 Make critical decisions about improving query processing
efficiency
 Can be gathered manually by DBA or automatically by DBMS
QUERY PROCESS
 DBMS processes queries in three phases
• Parsing
• DBMS parses the SQL query and chooses the most efficient
access/execution plan
• Execution
• DBMS executes the SQL query using chosen execution plan
• Fetching
• DBMS fetches the data and sends the result back to the client
SQL PARSING PHASE
 Break down query into smaller units
 Transform original SQL query into slightly different version of
original SQL code
• Fully equivalent
• Optimized query results are always the same as original query
• More efficient
• Optimized query will almost always execute faster than original query
SQL PARSING PHASE CONT.
 Query optimizer: Analyzes SQL query and finds most efficient
way to access data
• Validated for syntax compliance
• Validated against data dictionary
• Tables and column names are correct
• User has proper access rights
• Analyzed and decomposed into components
• Optimized into a fully equivalent but more efficient SQL query
• Prepared for execution by determining the most efficient execution
SQL PARSING PHASE CONT.
 Access plans: Result of parsing a SQL statement
• DBMS-Specific
• Translate client’s SQL query into a series of complex I/O operations
• Required to read the data from the physical data files and generate result
set
 DBMS checks if access plan already exists for query in SQL cache
 DBMS reuses the access plan to save time
 If it doesn’t, the optimizer evaluates various plans
• Chosen plan placed in SQL cache
SQL EXECUTION PHASE
 All I/O operations indicated in access plan are executed
• Locks acquired
• Data retrieved and placed in data cache
• Transaction management commands processed
SQL FETCHING PHASE
 All rows that match the specified condition(s) are
retrieved, sorted, grouped, and/or aggregated and results are
returned to the client
 DBMS might use temporary table space to store temporary data
QUERY PROCESSING
BOTTLENECKS
 Delay introduced in the processing of an I/O operation that slows
the system
• CPU
• RAM
• Hard disk
• Network
• Application code
INDEXES AND QUERY
OPTIMIZATION
 Indexes
• Crucial in speeding up data access
• Facilitate searching, sorting, and using aggregate functions as well as
join operations
• Ordered set of values that contains index key and pointers
 More efficient to use index to access table than to scan all rows in
table sequentially
INDEXES AND QUERY
OPTIMIZATION CONT.
 Data sparsity: number of different values a column could
possibly have
 Indexes implemented using:
• Hash indexes
• B-tree indexes
• Bitmap indexes
 DBMSs determine best type of index to use
ACCESS VS ORACLE
INDEXING

More Related Content

What's hot

SQL Server Performance Tuning Baseline
SQL Server Performance Tuning BaselineSQL Server Performance Tuning Baseline
SQL Server Performance Tuning Baseline► Supreme Mandal ◄
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceMark Ginnebaugh
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceVinod Kumar
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basicsnitin anjankar
 
Sql architecture
Sql architectureSql architecture
Sql architecturerchakra
 
Why & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryWhy & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryAntonios Chatzipavlis
 
Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767
Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767
Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767trainingindians
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database designSalehein Syed
 
Sql server performance tuning and optimization
Sql server performance tuning and optimizationSql server performance tuning and optimization
Sql server performance tuning and optimizationManish Rawat
 
Sap hana training in hyderabad
Sap hana training in hyderabadSap hana training in hyderabad
Sap hana training in hyderabadRajitha D
 
Presentation maximizing database performance performance tuning with db time
Presentation    maximizing database performance performance tuning with db timePresentation    maximizing database performance performance tuning with db time
Presentation maximizing database performance performance tuning with db timexKinAnx
 
Narendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_BangaloreNarendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_BangaloreNaremdra L
 
Is accurate system-level power measurement challenging? Check this out!
Is accurate system-level power measurement challenging? Check this out!Is accurate system-level power measurement challenging? Check this out!
Is accurate system-level power measurement challenging? Check this out!Deepak Shankar
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabaseTung Nguyen Thanh
 
2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-query2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-queryAshnikbiz
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracleTrainings
 
Rolta’s application testing services for handling ever changing environment.
Rolta’s application testing services for handling ever changing environment.   Rolta’s application testing services for handling ever changing environment.
Rolta’s application testing services for handling ever changing environment. Rolta
 

What's hot (19)

SQL Server Performance Tuning Baseline
SQL Server Performance Tuning BaselineSQL Server Performance Tuning Baseline
SQL Server Performance Tuning Baseline
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query PerformanceSQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query Performance
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basics
 
Sql architecture
Sql architectureSql architecture
Sql architecture
 
Why & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to queryWhy & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to query
 
Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767
Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767
Oracle dba training in Canada|Oracle dba training From Canada phno 09705612767
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database design
 
Sql server performance tuning and optimization
Sql server performance tuning and optimizationSql server performance tuning and optimization
Sql server performance tuning and optimization
 
Sap hana training in hyderabad
Sap hana training in hyderabadSap hana training in hyderabad
Sap hana training in hyderabad
 
Presentation maximizing database performance performance tuning with db time
Presentation    maximizing database performance performance tuning with db timePresentation    maximizing database performance performance tuning with db time
Presentation maximizing database performance performance tuning with db time
 
Narendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_BangaloreNarendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_Bangalore
 
Is accurate system-level power measurement challenging? Check this out!
Is accurate system-level power measurement challenging? Check this out!Is accurate system-level power measurement challenging? Check this out!
Is accurate system-level power measurement challenging? Check this out!
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL Database
 
2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-query2016 may-countdown-to-postgres-v96-parallel-query
2016 may-countdown-to-postgres-v96-parallel-query
 
Oracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance TuningOracle Performance Tuning Training | Oracle Performance Tuning
Oracle Performance Tuning Training | Oracle Performance Tuning
 
Rolta’s application testing services for handling ever changing environment.
Rolta’s application testing services for handling ever changing environment.   Rolta’s application testing services for handling ever changing environment.
Rolta’s application testing services for handling ever changing environment.
 

Viewers also liked

CS 542 -- Query Optimization
CS 542 -- Query OptimizationCS 542 -- Query Optimization
CS 542 -- Query OptimizationJ Singh
 
Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases Abdullatif Tarakji
 
التحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالجالتحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالجbosy sadek
 
MarketLine Country Statistics Database
MarketLine Country Statistics DatabaseMarketLine Country Statistics Database
MarketLine Country Statistics DatabaseMarketLine
 
Oracle hard and soft parsing
Oracle hard and soft parsingOracle hard and soft parsing
Oracle hard and soft parsingIshaan Guliani
 
Lesson5 Print and export databases
Lesson5 Print and export databases Lesson5 Print and export databases
Lesson5 Print and export databases Abdullatif Tarakji
 
Performance Tuning Azure SQL Database
Performance Tuning Azure SQL DatabasePerformance Tuning Azure SQL Database
Performance Tuning Azure SQL DatabaseGrant Fritchey
 
الوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتهاالوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتهاAmin Abu Hammad
 
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri Ramin Orujov
 
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013Jaime Crespo
 
Top frinds-انشاء-استعلام-بطريقه-المعالج-6-copy
Top frinds-انشاء-استعلام-بطريقه-المعالج-6-copyTop frinds-انشاء-استعلام-بطريقه-المعالج-6-copy
Top frinds-انشاء-استعلام-بطريقه-المعالج-6-copytop friends
 
Database system concepts and architecture
Database system concepts and architectureDatabase system concepts and architecture
Database system concepts and architectureMahmoud Almadhoun
 
Webinar: Performance Tuning + Optimization
Webinar: Performance Tuning + OptimizationWebinar: Performance Tuning + Optimization
Webinar: Performance Tuning + OptimizationMongoDB
 
الوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتهاالوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتهاAmin Abu Hammad
 
الوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتهاالوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتهاAmin Abu Hammad
 

Viewers also liked (20)

project in DBMS
project in DBMSproject in DBMS
project in DBMS
 
CS 542 -- Query Optimization
CS 542 -- Query OptimizationCS 542 -- Query Optimization
CS 542 -- Query Optimization
 
Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases
 
التحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالجالتحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالج
 
Lesson11 Create Query
Lesson11 Create QueryLesson11 Create Query
Lesson11 Create Query
 
Lesson8 Manage Records
Lesson8 Manage RecordsLesson8 Manage Records
Lesson8 Manage Records
 
Trabalho fitos digitais
Trabalho fitos digitaisTrabalho fitos digitais
Trabalho fitos digitais
 
MarketLine Country Statistics Database
MarketLine Country Statistics DatabaseMarketLine Country Statistics Database
MarketLine Country Statistics Database
 
Oracle hard and soft parsing
Oracle hard and soft parsingOracle hard and soft parsing
Oracle hard and soft parsing
 
Lesson5 Print and export databases
Lesson5 Print and export databases Lesson5 Print and export databases
Lesson5 Print and export databases
 
Performance Tuning Azure SQL Database
Performance Tuning Azure SQL DatabasePerformance Tuning Azure SQL Database
Performance Tuning Azure SQL Database
 
الوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتهاالوحدة التاسعة - قاعدة البيانات وادارتها
الوحدة التاسعة - قاعدة البيانات وادارتها
 
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri
 
أساسيات التأمين
أساسيات التأمينأساسيات التأمين
أساسيات التأمين
 
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
Query Optimization with MySQL 5.6: Old and New Tricks - Percona Live London 2013
 
Top frinds-انشاء-استعلام-بطريقه-المعالج-6-copy
Top frinds-انشاء-استعلام-بطريقه-المعالج-6-copyTop frinds-انشاء-استعلام-بطريقه-المعالج-6-copy
Top frinds-انشاء-استعلام-بطريقه-المعالج-6-copy
 
Database system concepts and architecture
Database system concepts and architectureDatabase system concepts and architecture
Database system concepts and architecture
 
Webinar: Performance Tuning + Optimization
Webinar: Performance Tuning + OptimizationWebinar: Performance Tuning + Optimization
Webinar: Performance Tuning + Optimization
 
الوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتهاالوحدة الخامسة - قاعدة البيانات وادارتها
الوحدة الخامسة - قاعدة البيانات وادارتها
 
الوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتهاالوحدة الثامنة - قاعدة البيانات وادارتها
الوحدة الثامنة - قاعدة البيانات وادارتها
 

Similar to Database Performance Tuning and Query Optimization Guide

Database Systems Design, Implementation, and Management
Database Systems Design, Implementation, and ManagementDatabase Systems Design, Implementation, and Management
Database Systems Design, Implementation, and ManagementOllieShoresna
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1sqlserver.co.il
 
high performance databases
high performance databaseshigh performance databases
high performance databasesmahdi_92
 
Remote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts
 
Presentation cloud control enterprise manager 12c
Presentation   cloud control enterprise manager 12cPresentation   cloud control enterprise manager 12c
Presentation cloud control enterprise manager 12cxKinAnx
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimizationUsman Tariq
 
Best storage engine for MySQL
Best storage engine for MySQLBest storage engine for MySQL
Best storage engine for MySQLtomflemingh2
 
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewKenny Buntinx
 
Monitorando performance no Azure SQL Database
Monitorando performance no Azure SQL DatabaseMonitorando performance no Azure SQL Database
Monitorando performance no Azure SQL DatabaseVitor Fava
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017EDB
 
Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...
Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...
Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...Microsoft Technet France
 
Time Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSTime Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSLaura Hood
 
Database performance monitoring:Key to seamless application performance
Database performance monitoring:Key to seamless application performanceDatabase performance monitoring:Key to seamless application performance
Database performance monitoring:Key to seamless application performanceManageEngine, Zoho Corporation
 
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshootingTarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshootingJovan Popovic
 

Similar to Database Performance Tuning and Query Optimization Guide (20)

Database Systems Design, Implementation, and Management
Database Systems Design, Implementation, and ManagementDatabase Systems Design, Implementation, and Management
Database Systems Design, Implementation, and Management
 
Dbms 3 sem
Dbms 3 semDbms 3 sem
Dbms 3 sem
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
Unit 2 oracle9i
Unit 2  oracle9i Unit 2  oracle9i
Unit 2 oracle9i
 
high performance databases
high performance databaseshigh performance databases
high performance databases
 
Remote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New Features
 
Presentation cloud control enterprise manager 12c
Presentation   cloud control enterprise manager 12cPresentation   cloud control enterprise manager 12c
Presentation cloud control enterprise manager 12c
 
Deep Dive on Amazon Redshift
Deep Dive on Amazon RedshiftDeep Dive on Amazon Redshift
Deep Dive on Amazon Redshift
 
Deep Dive on Amazon Redshift
Deep Dive on Amazon RedshiftDeep Dive on Amazon Redshift
Deep Dive on Amazon Redshift
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimization
 
Best storage engine for MySQL
Best storage engine for MySQLBest storage engine for MySQL
Best storage engine for MySQL
 
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
 
Monitorando performance no Azure SQL Database
Monitorando performance no Azure SQL DatabaseMonitorando performance no Azure SQL Database
Monitorando performance no Azure SQL Database
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017
 
Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...
Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...
Exchange Server 2013 : les mécanismes de haute disponibilité et la redondance...
 
Time Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSTime Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOS
 
Azure data platform overview
Azure data platform overviewAzure data platform overview
Azure data platform overview
 
Database performance monitoring:Key to seamless application performance
Database performance monitoring:Key to seamless application performanceDatabase performance monitoring:Key to seamless application performance
Database performance monitoring:Key to seamless application performance
 
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshootingTarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
Tarabica 2019 (Belgrade, Serbia) - SQL Server performance troubleshooting
 

Recently uploaded

INTERNATIONAL TRADE INSTITUTIONS[6].pptx
INTERNATIONAL TRADE INSTITUTIONS[6].pptxINTERNATIONAL TRADE INSTITUTIONS[6].pptx
INTERNATIONAL TRADE INSTITUTIONS[6].pptxaymenkhalfallah23
 
Role of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptxRole of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptxNarayaniTripathi2
 
Unit 4.1 financial markets operations .pdf
Unit 4.1 financial markets operations .pdfUnit 4.1 financial markets operations .pdf
Unit 4.1 financial markets operations .pdfSatyamSinghParihar2
 
2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGecko2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGeckoCoinGecko
 
Financial analysis on Risk and Return.ppt
Financial analysis on Risk and Return.pptFinancial analysis on Risk and Return.ppt
Financial analysis on Risk and Return.ppttadegebreyesus
 
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书rnrncn29
 
Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward
 
The Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance LeaderThe Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance LeaderArianna Varetto
 
NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...
NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...
NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...Amil baba
 
Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...
Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...
Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...Amil baba
 
Stock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdfStock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdfMichael Silva
 
Global Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride ConsultingGlobal Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride Consultingswastiknandyofficial
 
Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...Amil baba
 
10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdfglobusfinanza
 
Unveiling Business Expansion Trends in 2024
Unveiling Business Expansion Trends in 2024Unveiling Business Expansion Trends in 2024
Unveiling Business Expansion Trends in 2024Champak Jhagmag
 
AnyConv.com__FSS Advance Retail & Distribution - 15.06.17.ppt
AnyConv.com__FSS Advance Retail & Distribution - 15.06.17.pptAnyConv.com__FSS Advance Retail & Distribution - 15.06.17.ppt
AnyConv.com__FSS Advance Retail & Distribution - 15.06.17.pptPriyankaSharma89719
 
Overview of Inkel Unlisted Shares Price.
Overview of Inkel Unlisted Shares Price.Overview of Inkel Unlisted Shares Price.
Overview of Inkel Unlisted Shares Price.Precize Formely Leadoff
 
2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptxHenry Tapper
 
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》rnrncn29
 

Recently uploaded (20)

INTERNATIONAL TRADE INSTITUTIONS[6].pptx
INTERNATIONAL TRADE INSTITUTIONS[6].pptxINTERNATIONAL TRADE INSTITUTIONS[6].pptx
INTERNATIONAL TRADE INSTITUTIONS[6].pptx
 
Role of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptxRole of Information and technology in banking and finance .pptx
Role of Information and technology in banking and finance .pptx
 
Unit 4.1 financial markets operations .pdf
Unit 4.1 financial markets operations .pdfUnit 4.1 financial markets operations .pdf
Unit 4.1 financial markets operations .pdf
 
2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGecko2024 Q1 Crypto Industry Report | CoinGecko
2024 Q1 Crypto Industry Report | CoinGecko
 
Financial analysis on Risk and Return.ppt
Financial analysis on Risk and Return.pptFinancial analysis on Risk and Return.ppt
Financial analysis on Risk and Return.ppt
 
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
『澳洲文凭』买科廷大学毕业证书成绩单办理澳洲Curtin文凭学位证书
 
Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024
 
The Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance LeaderThe Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance Leader
 
NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...
NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...
NO1 Certified kala jadu karne wale ka contact number kala jadu karne wale bab...
 
Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...
Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...
Uae-NO1 Kala Jadu specialist Expert in Pakistan kala ilam specialist Expert i...
 
Stock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdfStock Market Brief Deck FOR 4/17 video.pdf
Stock Market Brief Deck FOR 4/17 video.pdf
 
Global Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride ConsultingGlobal Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride Consulting
 
Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
Uae-NO1 Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
 
10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf
 
Unveiling Business Expansion Trends in 2024
Unveiling Business Expansion Trends in 2024Unveiling Business Expansion Trends in 2024
Unveiling Business Expansion Trends in 2024
 
Q1 2024 Newsletter | Financial Synergies Wealth Advisors
Q1 2024 Newsletter | Financial Synergies Wealth AdvisorsQ1 2024 Newsletter | Financial Synergies Wealth Advisors
Q1 2024 Newsletter | Financial Synergies Wealth Advisors
 
AnyConv.com__FSS Advance Retail & Distribution - 15.06.17.ppt
AnyConv.com__FSS Advance Retail & Distribution - 15.06.17.pptAnyConv.com__FSS Advance Retail & Distribution - 15.06.17.ppt
AnyConv.com__FSS Advance Retail & Distribution - 15.06.17.ppt
 
Overview of Inkel Unlisted Shares Price.
Overview of Inkel Unlisted Shares Price.Overview of Inkel Unlisted Shares Price.
Overview of Inkel Unlisted Shares Price.
 
2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx
 
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
《加拿大本地办假证-寻找办理Dalhousie毕业证和达尔豪斯大学毕业证书的中介代理》
 

Database Performance Tuning and Query Optimization Guide

  • 1. CHAPTER 11: DATABASE PERFORMANCE TUNING AND QUERY OPTIMIZATION Jonathan Weinberg Andrew Casteen
  • 2. OBJECTIVES  Basic database performance-tuning concepts  How a DBMS processes SQL queries  About the importance of indexes in query processing  About the types of decisions the query optimizer has to make  Some common practices used to write efficient SQL code  How to formulate queries and tune the DBMS for optimal performance
  • 3. DATABASE PERFORMANCE- TUNING CONCEPTS  Goal of database performance is to execute queries as fast as possible  Database performance tuning • Set of activities and procedures designed to reduce response time of database system  All factors must operate at optimum level with minimal bottlenecks  Good database performance starts with good database design (you can't polish a turd)
  • 4. PERFORMANCE TUNING: CLIENT AND SERVER  Client side • Generate a SQL query that returns the correct answer in the least amount of time • Using the minimum amount of resources at the server end • SQL performance tuning – The activities required to achieve that goal  Server side • DBMS environment configured to respond to the clients’ requests as fast as possible • Optimum use of existing resources • DBMS performance tuning – The activities required to achieve that goal
  • 5. DBMS ARCHITECTURE  All data in database are stored in data files  Data files • Can automatically expand in predefined increments known as extends • Grouped in file groups or table spaces  Table space or file group • Logical grouping of several data files that store data with similar characteristics
  • 6. DBMS ARCHITECTURE CONT.  Data cache or buffer cache • Shared, reserved memory area that stores the most recently accessed data blocks in RAM  SQL cache or procedure cache • Shared, reserved memory area that stores the most recently executed SQL statements or PL/SQL procedures, including triggers and functions  DBMS retrieves data from permanent storage and places it in RAM
  • 7. DBMS ARCHITECTURE CONT.  Input/output (I/O) request: low-level data access operation to and from computer devices  Data cache is faster than data in data files because the DBMS does not wait for hard disk to retrieve data  Majority of performance-tuning activities focus on minimizing the number of I/O operations  Typical DBMS processes: • Listener, user, scheduler, lock manager, optimizer
  • 8.
  • 9. DBMS PROCESSES  Listener: Takes clients’ requests and handles the processing of the SQL requests to other DBMS processes. Once received, the request is passes to appropriate user process  User: Created to manage each client session and handles all requests submitted to the server  Scheduler: Organizes the concurrent execution of SQL requests
  • 10. DBMS PROCESSES CONT.  Lock Manager: Manages all locks placed on database objects  Optimizer: Analyzes SQL queries and finds the most efficient way to access the data
  • 11. DATABASE STATISTICS  Number of measurements about database objects and available resources: • Number of processors used • Processor speed • Temporary space available  Make critical decisions about improving query processing efficiency  Can be gathered manually by DBA or automatically by DBMS
  • 12. QUERY PROCESS  DBMS processes queries in three phases • Parsing • DBMS parses the SQL query and chooses the most efficient access/execution plan • Execution • DBMS executes the SQL query using chosen execution plan • Fetching • DBMS fetches the data and sends the result back to the client
  • 13.
  • 14. SQL PARSING PHASE  Break down query into smaller units  Transform original SQL query into slightly different version of original SQL code • Fully equivalent • Optimized query results are always the same as original query • More efficient • Optimized query will almost always execute faster than original query
  • 15. SQL PARSING PHASE CONT.  Query optimizer: Analyzes SQL query and finds most efficient way to access data • Validated for syntax compliance • Validated against data dictionary • Tables and column names are correct • User has proper access rights • Analyzed and decomposed into components • Optimized into a fully equivalent but more efficient SQL query • Prepared for execution by determining the most efficient execution
  • 16. SQL PARSING PHASE CONT.  Access plans: Result of parsing a SQL statement • DBMS-Specific • Translate client’s SQL query into a series of complex I/O operations • Required to read the data from the physical data files and generate result set  DBMS checks if access plan already exists for query in SQL cache  DBMS reuses the access plan to save time  If it doesn’t, the optimizer evaluates various plans • Chosen plan placed in SQL cache
  • 17. SQL EXECUTION PHASE  All I/O operations indicated in access plan are executed • Locks acquired • Data retrieved and placed in data cache • Transaction management commands processed
  • 18. SQL FETCHING PHASE  All rows that match the specified condition(s) are retrieved, sorted, grouped, and/or aggregated and results are returned to the client  DBMS might use temporary table space to store temporary data
  • 19. QUERY PROCESSING BOTTLENECKS  Delay introduced in the processing of an I/O operation that slows the system • CPU • RAM • Hard disk • Network • Application code
  • 20. INDEXES AND QUERY OPTIMIZATION  Indexes • Crucial in speeding up data access • Facilitate searching, sorting, and using aggregate functions as well as join operations • Ordered set of values that contains index key and pointers  More efficient to use index to access table than to scan all rows in table sequentially
  • 21. INDEXES AND QUERY OPTIMIZATION CONT.  Data sparsity: number of different values a column could possibly have  Indexes implemented using: • Hash indexes • B-tree indexes • Bitmap indexes  DBMSs determine best type of index to use