Database tuning Flashcards
What is Database tuning ?
A set of activities and procedures designed to reduce the response time of the database system.
Factors determines the performance
CPU processing power
Available primary memory (RAM)
Input / Output
Data files and Data space
Data files - all data in a database are stored in data files, while data space is a logical grouping of data files with similar characteristics
Data cache or buffer cache and SQL cache or procedure cache
Data cache - reserved memory area for the most recently accessed data blocks in RAM
SQL cache - shared,reserved memory for the recently executed SQL statement or procedure or functions
IO request
low - level read or write data access operation from and to computer devices
Database statistics
number of measurements of database objects like no. of processors used, processor speed and temp space available.
Different factors of database statistics
- Table - no. of tables, mo. of disk blocks uesd, row length, no. of columns in each row, max and min of each column
- Indexes - no and name of columns in index key and etc
- Environmental Resources - logical and physical disk block size, location of data blocks
3 steps of query processing
Parsing, Execution and Fetching
Parsing of query processing
- Breaking down and transform the original query into fully equivalent and more efficient
- performed by the query optimizer, which analyze the SQL query and find the most efficient way to ACCESS THE DATA
Step involved in parsing
- Syntax check
- Naming check
- Access right check
- Decompose and analyze
- Generate access plan
- Store access plan in the SQL cache
QUery processing bottlenecks and factors that cause it
A delay introduced in the processing of an IO operation that cause delay in the overall system to slow down.
5 factors that causes it
1. CPU 2. RAM 3. Hard disk 4. Network and 5. Application code
3 data structures to implement data index
- Hash index - based on an ordered list of hash values
- B-tree index - ordered data structure organized as an upside - down tree (commonly used)
- Bitmap index - uses a bit array to represent the existence of a value or condition (used in data warehousing)
Two modes of query optimizer
- Rule - based: uses preset rules and points to determine the best approach
- Cost - based: use sophisticated approach based on statistics about the object being accessed
Optimizer hints and its types
Special instructions for the optimizer embedded in the sql statements
ALL_ROWS, FIRST_ROWS and index(name)