Optimizing SQL code is the #1 factor in improving Oracle database performance, yet most guides to Oracle tuning virtually ignore SQL. Oracle SQL High Performance Tuning, Second Edition zeroes in on SQL, showing how to achieve performance gains of 100% in many applications. Expert Oracle developer Guy Harrison gives Oracle developers and DBAs a single source for guidance on every aspect of Oracle 8i SQL and PL/SQL tuning. Harrison begins with a detailed overview of SQL processing in Oracle, and then introduces SQL tuning guidelines that improve virtually any application. Learn how to trace SQL statement execution, create more effective indexes, identify and resolve Oracle Server bottlenecks, and fix poorly performing SQL code. Master Oracle tuning tools such as tkprof and explain; leverage Oracle's parallel query facility for large-volume queries; and maximize the performance of Oracle clusters. The book outlines up-front design techniques for enhancing application efficiency; includes detailed real-world tuning guidelines for both SQL and PL/SQL; and presents opportunities to improve performance by substituting PL/SQL or Java for SQL.
I. INTRODUCTION TO SQL TUNING. 1. Introduction to SQL Tuning.
Introduction. Why Tune SQL? The Place of SQL Tuning in the Overall Tuning Process. When Should SQL be Tuned? The Tuning Process. Constructing a Tuning Environment. Tuning SQL. Summary.2. SQL Tuning Quick Start.
Introduction. Top Tips and Hints for SQL Tuning. SQL Tuning Quick Tips.3. Review of SQL.
Introduction. The History of SQL. Types of SQL Statements. Query Operations: The SELECT Statement. Data Manipulation and Transaction Control. Summary.
II. SQL TUNING THEORY. 4. SQL Processing Internals.
Introduction. Overview of SQL Processing. Creating and Parsing Cursors. The Cursor_Sharing Option in Oracle. Executing SQL. Types of Table Accesses. Joins. Sorting and Grouping. Modifying Data. Summary.5. The Optimizer.
Introduction. Overview of Optimization. Collecting Optimizer Statistics. Using Plan Stability. Using Hints. Using Hints to Change the Access Path. Using Hints to Change the Join Order. Errors in Hint Specifications. Summary.6. Indexing and Clustering.
Introduction. B*-tree Indexes. Clustering. Bitmap Indexes. Index Organized Tables. Summary.7. Tracing and Explaining SQL.
Introduction. Explain Plan. Using Explain Plan. SQL Trace. Overview of the SQL Tracing Process. Preparing to Use SQL Trace. Enabling SQL Trace Within a Session. Enabling SQL Trace from Another Session. Finding the Trace File. Using Tkprof. Tkprof Sort Options. Other Tkprof Options. Troubleshooting SQL_TRACE and Tkprof. Interpreting Tkprof Output. Tkprof Execution Statistics. Tkprof Execution Plans. Tuning SQL with Tkprof Output. Tkprof Rules, OK? The SQL*PLUS AUTOTRACE Option. Requirements for Using AUTOTRACE. Initiating AUTOTRACE. AUTOTRACE Output. AUTOTRACE Compared to Tkprof. Summary.
III. SQL TUNING IN PRACTICE. 8. Tuning Table Access.
Introduction. When to Use a Full-Table Scan. How the Optimizer Chooses Between Indexes _and Full-Table Scan. Column Histograms. Avoiding "Accidental" Table Scans. Not Equals Conditions. Searching For Nulls. Searching for Values That are NOT NULL. Creating Indexes on NULLable Columns. Searching for a Selective Value in an Unselective Column. Unintentionally Disabling an Index With a Function. Functional Indexes. Choosing the Best Indexing Strategy. How Many Distinct Values are Too Many For a Bitmap Index? Deciding To Use an Index Organized Table. Optimizing B*-tree Index Lookups. Types of Index Retrievals. Using Concatenated Indexes. Index Merges. Searching for Ranges. Optimizing Bitmap Index Access. Optimizing Hash Clusters. Optimizing Index Organized Tables. Optimizing Full Table Scans. Optimizing for the First Row. Summary.9. Tuning Joins and Subqueries.
Introduction. Choosing the Best Join Method. Optimizing the Join. Special Joins. Subqueries. Semijoins. Antijoins. Summary.10. Sorts, Aggregates, and SET Operations.
Introduction. Sort Operations. Aggregate Operations. SET Operations. Summary.11. Parallel SQL.
Introduction. Understanding Parallel SQL. Using Parallel Query. Tuning Parallel Query. Examples of Parallel Queries. Other Parallel Operations. Summary.12. Optimizing DML.
Introduction. General Optimizations. Optimizing INSERTS. Optimizing Transactions. Parallel DML. Summary.13. VLDB and Warehousing.
Introduction. Partitioning. Materialized Views and Snapshots. Summary.14. Using and Tuning PL/SQL.
Introduction. Performance Characteristics of PL/SQL. Using PL/SQL in Place of Standard SQL. Optimizing PL/SQL. Dynamic SQL and PL/SQL. Using the PL/SQL Profiler. Summary.15. Using and Tuning Oracle Java.
Introduction. Java as an Alternative to PL/SQL. Computationally Intensive Routines. Database-Intensive Routines. Java or PL/SQL? Using Bind Variables in JDBC. Cursor Handling. Avoid Autocommit. Using Array Processing (JDBC 1). Using Array Processing (JDBC 2). Using Oracle Datatypes. Bind Variables. Cursor Management. Array Processing. JDBC or SQJ or PL/SQL? Summary.16. Oracle Object Types.
Introduction. Object Type Alternatives to Master-Detail Tables. Performance Comparisons for Object Types. Summary.17. Miscellaneous Topics.
Introduction. Optimizing Views. Distributed SQL. Distributed Joins. Sequences. Using DECODE. Optimizing Data Definition Language. Tuning Access to the V$ Tables. Summary.
IV. BEYOND SQL TUNING. 18. Application Design Issues.
Introduction. Building Tuning into the Design Process. Establishing an Efficient Physical Model. Application Design. Summary.19. Oracle Server Design.
Introduction. A Review of the Oracle Architecture. Sizing the Host Computer. Essential Considerations for Database Configuration. Optimizing Database I/O. Sizing the SGA. Multithreaded Servers. Parallel Query Processes. Summary.20. Oracle Server Tuning.
Introduction. Evaluating Operating System Performance. Recognizing Oracle Database Bottlenecks. Identifying Resource Intensive SQL. Summary.Appendix A: Reference. Appendix B: Glossary. Appendix C: Configuring Development Tools. Appendix D: Oracle Server Configuration. Appendix E: Bibliography and Resources. Index.