Database Tuning - Cấu trúc dữ liệu và giải thuật (ET2100) | Trường Đại học Bách khoa Hà Nội

Activity of making a database application run faster: Faster means higher throughput (or responsetime), Avoiding transactions that create bottlenecks oravoiding queries that run for hours unnecessarily is a must, A 5% improvement is significant.

Thông tin:
6 trang 4 tháng trước

Bình luận

Vui lòng đăng nhập hoặc đăng ký để gửi bình luận.

Database Tuning - Cấu trúc dữ liệu và giải thuật (ET2100) | Trường Đại học Bách khoa Hà Nội

Activity of making a database application run faster: Faster means higher throughput (or responsetime), Avoiding transactions that create bottlenecks oravoiding queries that run for hours unnecessarily is a must, A 5% improvement is significant.

37 19 lượt tải Tải xuống
lOMoARcPSD| 27879799
1
Adapted from book materials “Database Tuning
Principles, Experiments and Troubleshoong Techniques”
1
What is Database Tuning?
Acvity of making a database applicaon run faster:
Faster means higher throughput (or responseme)
Avoiding transacons that create bolenecks
oravoiding queries that run for hours unnecessarily is
a must.
A 5% improvement is signicant.
2
lOMoARcPSD| 27879799
2
Why Database Tuning?
Troubleshoong:
Make managers and users happy given an
applicaon and a DBMS Capacity Sizing:
Buy the right DBMS given applicaon requirements
Applicaon Programming:
Coding your applicaon for performance
3
Why is Database Tuning hard?
4
lOMoARcPSD| 27879799
3
Outline
Schema tuning
Index tuning
Query Processing
Query tuning
Transacon Management
Transacon tuning
Tuning Distributed Applicaon
6
lOMoARcPSD| 27879799
4
Tuning Principles
1. Think globally, x locally
2. Paroning breaks bolenecks
temporal and spaal
3. Start-up costs are high; running costs are low
4. Render unto server what is due unto server
5. Be prepared for trade-os 7
Think globally, x locally
Proper idencaon of problem; minimal intervenon
Understand the whole, including the applicaon goals
before taking a set of queries and nd the indexes
that speed them up.
Example:
High I/O, paging and processor ulizaon may be due to frequent
query scans instead of using an index or log sharing a disk with
some frequently accessed data.
8
Paroning breaks bolenecks
lOMoARcPSD| 27879799
5
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
me
Paroning may not always solve boleneck:
First, try to speed up the component
If it doesn’t work, paron
Example:
Lock and resource contenon among long and short
transacons
9
Start-up costs are high; running costs are
low
Obtain the eect you want with the fewest possible
start-ups
Examples:
It is expensive to begin a read operaon on a disk, but once
it starts disk can deliver data at high speed.
So, frequently scanned tables should be laid out consecuvely on
disk.
Cost of parsing, semanc analysis, and selecng access
paths for simple queries is signicant So, oen executed
queries should be compiled
10
lOMoARcPSD| 27879799
6
Render unto server what is due unto
server
Important design queson is the allocaon of work
between the DB system (server) and the applicaon
program (client)
Depends on:
Relave compung resources of client and server
Where the relevant informaon is located
Whether the DB task interacts with the screen
11
Be prepared for trade-os
Increasing speed of applicaon requires combinaon
of memory, disk and computaonal resources
Examples:
Adding an index => speeds up crical query, but increases
disk storage, and space in RAM
Increasing RAM => Decreasing I/O, speed up query, but
spending more money
12
| 1/6

Preview text:

lOMoAR cPSD| 27879799
Adapted from book materials “Database Tuning
Principles, Experiments and Troubleshooting Techniques” 1 What is Database Tuning?
Activity of making a database application run faster:
– Faster means higher throughput (or responsetime)
– Avoiding transactions that create bottlenecks
oravoiding queries that run for hours unnecessarily is a must.
– A 5% improvement is significant. 2 1 lOMoAR cPSD| 27879799 Why Database Tuning? Troubleshooting:
Make managers and users happy given an
application and a DBMS Capacity Sizing:
Buy the right DBMS given application requirements Application Programming:
Coding your application for performance 3 Why is Database Tuning hard? 4 2 lOMoAR cPSD| 27879799 Outline Schema tuning Index tuning Query Processing Query tuning Transaction Management Transaction tuning
Tuning Distributed Application 6 3 lOMoAR cPSD| 27879799 Tuning Principles 1. Think globally, fix locally 2.
Partitioning breaks bottlenecks temporal and spatial 3.
Start-up costs are high; running costs are low 4.
Render unto server what is due unto server 5. Be prepared for trade-offs 7 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. 8
Partitioning breaks bottlenecks 4 lOMoAR cPSD| 27879799
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 9
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 So, often executed queries should be compiled 10 5 lOMoAR cPSD| 27879799
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 11 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 12 6