Expert Oracle SQL: Optimization, Deployment, and Statistics (2014)


When Jonathan Gennick from Apress approached me with a request to write the foreword for this book, I said yes without thinking for too long, as I already knew the quality of Tony’s work. He has a good, practical approach to understanding and fixing Oracle problems and for optimizing inefficient code.

Optimizing SQL performance is not always about providing more-detailed optimizer statistics for faster execution plans. Sometimes you want to provide less-detailed information to the cost-based optimizer and freeze the statistics to achieve better stability in SQL performance. Such an approach may initially sound counterintuitive and off the mainstream, but it can avoid headaches and midnight phone calls later if SQL plan stability is important to you. As always, you will need to apply such techniques correctly and in the right situations. Tony explains the thought process behind SQL optimization and statistics management for both performance and stability, and also provides tools and examples to put his approach into use.

Another great value of this book lies in the numerous practical examples of how to optimize SQL by rewriting or adjusting your queries and statements. You absolutely need the mindset and skill for real-life SQL optimization, as desperately regathering the optimizer statistics, or creating yet another index, may not provide any noticeable performance gains for your problem SQL. Hence the need to rewrite or adjust, and multiple chapters in the second half of the book help by dealing with various ways you (or the Oracle optimizer) can optimize the form of your SQL.

In addition to Chapter 16 (“Rewriting Queries”) and Chapter 17 (“Optimizing Sorts”), you have over 70 pages’ worth of optimizer transformations explained in Chapter 13! The content in these three chapters helps you to understand why the final execution plan for a query may often look quite different from what the original SQL was supposed to do, while still delivering correct results, but faster. And this all, in turn, helps you to write more efficient SQL in the first place.

When reading this book, remember that roughly the first half of this book consists of a number of shorter chapters, each introducing you to different parts of the Oracle Database’s SQL optimization and runtime features. These first chapters serve as building blocks ready to be put into use in the later parts of the book, where all the pieces fall together.

You will gain plenty of new knowledge and will also have fun reading this book!

—Tanel Põder

Tanel Põder is one of the leading Oracle Database performance specialists in the world, having helped solve complex problems for customers in 25 countries on five continents. He works for Enkitec as a technology evangelist, focusing on advanced Oracle, Linux, and Hadoop performance topics, including Exadata and the brand-new In-Memory Database Option. Tanel has received the “Oracle ACE Director” recognition for his community contribution, is a proud member of the OakTable Network, and he is a co-author of Expert Oracle Exadata, also published by Apress