Download Database Tuning Class Introduction

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Database Tuning
Principles, Experiments and
Troubleshooting Techniques
Baseado nos slides do tutorial com o mesmo nome da autoria de:
Dennis Shasha ([email protected])
Philippe Bonnet ([email protected])
E nos slides disponíveis no Web site do livro:
http://www.databasetuning.org/
Introduction
What is Database Tuning?
Activity of making a database application run
faster:
– Faster means higher throughput (or response
time)
– Avoiding transactions that create bottlenecks or
avoiding queries that run for hours unnecessarily is a
must.
– A 5% improvement is significant.
AOBD 2007/08
H. Galhardas
Why Database Tuning?

Troubleshooting:


Capacity Sizing:


Make managers and users happy given an
application and a DBMS
Buy the right DBMS given application
requirements
Application Programming:

Coding your application for performance
AOBD 2007/08
H. Galhardas
Why is Database Tuning hard?
sql
commands
PARSER
OPTIMIZER
EXECUTION
SUBSYSTEM
DISK
SYBSYSTEM
CACHE
MANAGER
LOCKING
SUBSYSTEM
The following query
runs too slowly
select *
from R
where R.a > 5;
LOGGING
SUBSYSTEM
What do you do?
MEMORY
AOBD 2007/08
CPU
DISK/
CONTROLLER
NETWORK
H. Galhardas
Application
Programmer
(e.g., business analyst,
Data architect)
Application
Sophisticated
Application
Programmer
Query Processor
(e.g., SAP admin)
Indexes
Storage Subsystem
Concurrency Control
Recovery
DBA,
Tuner
Operating System
Hardware
[Processor(s), Disk(s), Memory]
AOBD 2007/08
H. Galhardas
Course Objectives
Relevant notions concerning the internals of
commercial DBMS
Tuning Principles

1.
Backed by experiments : How do tuning principles impact
performances on my system?

Troubleshooting Methodology:
2.





Troubleshooting (what is happening?)
Hypothesis formulation
What is the cause of the problem?
Apply tuning principles to propose a fix
Hypothesis verification (experiments)
AOBD 2007/08
H. Galhardas
Outline
1.
2.
Basic Principles
Tuning the guts
1.
2.
3.
3.
4.
Concurrency control and recovery
OS configuration
HW modifications
Indexes
Relational Systems
1.
2.
Design of table schema, normalization, etc
Query tuning
Application Interface
6.
Ecommerce Applications
7.
Data warehouse Applications
8.
Distributed Applications
AOBD 2007/08
H. Galhardas
9.
Troubleshooting
5.
Tuning Principles
Think globally, fix locally
Partitioning breaks bottlenecks
1.
2.

3.
4.
5.
temporal and spatial
Start-up costs are high; running costs are
low
Render unto server what is due unto server
Be prepared for trade-offs
AOBD 2007/08
H. Galhardas
Think globally, fix locally



Proper identification of problem; minimal intervention
Understand the whole, including the application
goals before taking a set of queries and find the
indexes that speed them up.
Example:

High I/O, paging and processor utilization may be due to
frequent query scans instead of using an index or log
sharing a disk with some frequently accessed data.
AOBD 2007/08
H. Galhardas
Partitioning breaks bottlenecks


Technique for reducing the load on a certain
component of the system either by dividing
the load over more resources or by spreading
the load over time
Partitioning may not always solve bottleneck:



First, try to speed up the component
If it doesn’t work, partition
Example:

Lock and resource contention among long and
short transactions
AOBD 2007/08
H. Galhardas
Start-up costs are high; running costs
are low


Obtain the effect you want with the fewest
possible start-ups
Examples:

It is expensive to begin a read operation on a disk,
but once it starts disk can deliver data at high
speed.


So, frequently scanned tables should be laid out
consecutively on disk.
Cost of parsing, semantic analysis, and selecting
access paths for simple queries is significant

AOBD 2007/08
So, often executed queries should be compiled
H. Galhardas
Render unto server what is due unto
server


Important design question is the allocation of
work between the DB system (server) and
the application program (client)
Depends on:



Relative computing resources of client and server
Where the relevant information is located
Whether the DB task interacts with the screen
AOBD 2007/08
H. Galhardas
Be prepared for trade-offs


Increasing speed of application requires
combination of memory, disk and
computational resources
Examples:


Adding an index => speeds up critical query, but
increases disk storage, and space in RAM
Increasing RAM => Decreasing I/O, speed up
query, but spending more money
AOBD 2007/08
H. Galhardas
Outline


Basic Principles
Tuning the guts
1.
2.
3.
3.
4.
Concurrency control and recovery
OS configuration
HW modifications
Indexes
Relational Systems
1.
2.
Design of table schema, normalization, etc
Query tuning
Application Interface
6.
Ecommerce Applications
7.
Data warehouse Applications
8.
Distributed Applications
AOBD 2007/08
H. Galhardas
9.
Troubleshooting
5.
Related documents