* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download 1. Introduction to SQL Tuning
Survey
Document related concepts
Serializability wikipedia , lookup
Relational algebra wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Concurrency control wikipedia , lookup
Tandem Computers wikipedia , lookup
Ingres (database) wikipedia , lookup
Microsoft Access wikipedia , lookup
Oracle Database wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Database model wikipedia , lookup
Clusterpoint wikipedia , lookup
Relational model wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Transcript
Introduction to SQL Tuning Page 1 1. Introduction to SQL Tuning © 2001 SkillBuilders, Inc. © 2001 SkillBuilders, Inc. SKILLBUILDERS V 1.3 Introduction to SQL Tuning Page 2 Introduction to SQL Tuning 1.2 1. 2 Objectives Ø Understand what can be tuned Ø Understand what we need to know in order to tune SQL © 2001 SkillBuilders, Inc. © 2001 SkillBuilders, Inc. V 1.3 Introduction to SQL Tuning Page 3 Introduction to SQL Tuning 1.3 1. 3 What Can Be Tuned? Ø Data Access Ø Ø SQL Application Logic: 3GL code, PL/SQL Ø Database server Ø Instance Tuning, Memory Tuning Ø Utilities Ø SQL*Loader, Import/Export Ø Network Ø Net8, network infrastructure © 2001 SkillBuilders, Inc. SQL statements such as SELECT, UPDATE and DELETE utilize the Oracle optimizer to determine the fastest access path. However, we can influence the decision of the optimizer when needed to alter the access path. This is the process of tuning the statement. Application logic can be tuned. For example, a 3GL such as C or COBOL can incorporate array processing. PL/SQL can use bulk bind, available in Oracle8i. The database server itself can be tuned - the sized of memory areas such as the database buffer cache have a huge impact on overall performance. Also, tuning the background processes such as DBWR and LGWR is possible. Utilities such as SQL*LOADER can be tuned to optimize the loading of large amounts of data in the the database. For example, the direct path optio n can significantly reduce overall load times. Finally, the network can be tuned. From and Oracle perspective, this would include tuning Net8 (formerly SQL*Net). Options such as connection pooling can be critical in today’s world of high access internet applications © 2001 SkillBuilders, Inc. V 1.3 Introduction to SQL Tuning Page 4 Introduction to SQL Tuning 1.4 1. 4 What This Course Covers Ø Data Access Tuning Ø Tuning SQL Statements Ø Tuning PL/SQL programs © 2001 SkillBuilders, Inc. In this course we will cover SQL tuning and application logic tuning, including tuning PL/SQL programs. Tuning the database server, network and utilities is covered in a database performance tuning for administrators class. © 2001 SkillBuilders, Inc. V 1.3 Introduction to SQL Tuning Page 5 Introduction to SQL Tuning 1.5 1. 5 Tuning SQL: What We Need to Know Ø Understand database processes Ø SQL statement execution, optimization, parallel execution Ø Understand database memory structures Ø Shared Pool, Database Buffer Cache Ø Understand database objects Ø Ø tables, indexes B-Tree, Bitmap, Index-Organized Tables, Based Indexes, Reverse Key Indexes Function- © 2001 SkillBuilders, Inc. Tuning an SQL statement requires the understanding of many things about the database such as: Ø Database Processes - You must understand how a statement is executed by Oracle and how the Oracle optimizer works. Also, parallelization is critical, especially in multi-CPU environments. Ø Memory Processes - You must understand the purpose of the shared pool and database buffer cache. Ø Database Objects - It is not possible to tune an SQL statement without understanding indexes! Data storage in tables or clusters can also have an effect. Ø Access Paths - The Oracle optimizer can choose from many different access paths. You must understand what these are and which may provide better performance under the current circumstances. Ø Explain and Trace - You will need to learn the mechanics of determining what is going on when you execute the statement you are trying to tune. Tools such as EXPLAIN and trace allow us to see under the covers! © 2001 SkillBuilders, Inc. V 1.3 Introduction to SQL Tuning Page 6 Introduction to SQL Tuning 1.6 1. 6 Tuning SQL: What We Need to Know Ø Understand Access Paths Ø Full Scans, Index Scans Ø Learn to Explain and Trace Statements Ø Externalize access path being used - EXPLAIN Ø Tune the SQL Statement! Ø Add, modify or drop indexes Ø use hints Ø recode the SQL statement Ø and more! © 2001 SkillBuilders, Inc. © 2001 SkillBuilders, Inc. V 1.3 Introduction to SQL Tuning Page 7 Introduction to SQL Tuning 1.7 1. 7 Tuning Programs: What We Need to Know Ø PL/SQL Ø Promote use of stored database objects Ø Packages Ø Bulk Binds Ø General Ø Sequences Ø Ø Deadlock avoidance Rollback Segments © 2001 SkillBuilders, Inc. PL/SQL programs can be tuned. Just the proper use of stored PL/SQL programs will increase the performance of your application, implementing PL/SQL packages and techniques such as bulk bind will also increase performance. Application performance (3GL or PL/SQL) can sometimes be improved with the use of sequences, coding for deadlock avoidance and be segregating UNDO into a separate rollback segment. All of the techniques mentioned above will be covered in this course © 2001 SkillBuilders, Inc. V 1.3