Chapter 4. Optimizing SQL Code

In this chapter, we will cover the following topics:

  • Using bind variables
  • Avoiding full table scans
  • Exploring index lookup
  • Exploring index skip-scan and index range-scan
  • Introducing arrays and bulk operations
  • Optimizing joins
  • Using subqueries
  • Tracing SQL activity with SQL Trace and TKPROF

Introduction

In this chapter, we will see how to diagnose and solve typical performance problems caused by poorly written SQL code. We will inspect both queries and Data Manipulation Language (DML), starting with the correct use of bind variables in the first recipe.

This chapter will illustrate various aspects related to SQL code, providing solutions to the most common issues. We will see how to avoid full table scans, when possible,using ...

Get Oracle Database 11gR2 Performance Tuning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.