FREE Delivery in the UK.
Only 3 left in stock (more on the way).
Dispatched from and sold by Amazon. Gift-wrap available.
SQL Tuning has been added to your Basket

Dispatch to:
To see addresses, please
Please enter a valid UK postcode.
+ £2.80 UK delivery
Used: Good | Details
Condition: Used: Good
Comment: A good reading copy. May contain markings or be a withdrawn library copy. Expect delivery in 2-3 weeks.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

SQL Tuning Paperback – 29 Nov 2003

See all 5 formats and editions Hide other formats and editions
Amazon Price
New from Used from
Kindle Edition
£20.99 £15.89
Note: This item is eligible for click and collect. Details
Pick up your parcel at a time and place that suits you.
  • Choose from over 13,000 locations across the UK
  • Prime members get unlimited deliveries at no additional cost
How to order to an Amazon Pickup Location?
  1. Find your preferred location and add it to your address book
  2. Dispatch to this address when you check out
Learn more
click to open popover

Frequently bought together

  • SQL Tuning
  • +
  • SQL Cookbook (Cookbooks (O'Reilly))
Total price: £63.98
Buy the selected items together

What other items do customers buy after viewing this item?

Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.

  • Apple
  • Android
  • Windows Phone

To get the free app, enter your mobile phone number.

All Amazon Original Books on Sale
Browse a selection of over 160+ Kindle Books currently on sale. Learn more

Product details

  • Paperback: 338 pages
  • Publisher: O'Reilly Media; 1 edition (29 Nov. 2003)
  • Language: English
  • ISBN-10: 0596005733
  • ISBN-13: 978-0596005733
  • Product Dimensions: 17.8 x 2.1 x 23.3 cm
  • Average Customer Review: Be the first to review this item
  • Amazon Bestsellers Rank: 1,096,589 in Books (See Top 100 in Books)
  • Would you like to tell us about a lower price?
    If you are a seller for this product, would you like to suggest updates through seller support?

  • See Complete Table of Contents

Product description

About the Author

Dan Tow is an independent consultant, operating under the banner SingingSQL ( His experience solving Oracle-related performance problems goes all the way back to his 1989 hire by Oracle Corporation. During most of his tenure at Oracle, Dan focused on the performance of Oracle Applications, managing the performance group for that division. In this role, he found a fertile testing ground for his SQL tuning method applied to the huge set of complex SQL included in those applications, including both online SQL and diverse batch processes. In 1998, Dan left Oracle to lead performance for TenFold Corporation, where he applied the same methods to tuning questions on DB2, and SQL Server, and Sybase, as well as on Oracle. In 2002, Dan started his own business, SingingSQL, through which he offers diverse database-related tuning services, including SQL tuning and systematically analyzing load to learn which SQL should be tuned. He has introduced his SQL tuning method to over 1,000 people in short lectures, and now offers in-depth courses in the material, using this book as textbook. Dan has a Ph.D. in chemical engineering from the University of Wisconsin at Madison. He lives in Palo Alto, California, and can be reached at

Excerpt. © Reprinted by permission. All rights reserved.

CHAPTER 1 – Introduction

Well begun is half done.
Politics, Bk. V, Ch. 4

This book is for readers who already know SQL and have an opportunity to tune SQL or the database where the SQL executes. It includes specific techniques for tuning on Oracle, Microsoft SQL Server, and IBM DB2. However, the main problem of SQL tuning is finding the optimum path to the data. (The path to the data is known as the execution plan.) This optimum path is virtually independent of the database vendor, and most of this book covers a vendor-independent solution to that problem.

The least interesting, easiest parts of the SQL tuning problem are vendor-specific techniques for viewing and controlling execution plans. For completeness, this book covers these parts of SQL tuning as well, for Oracle, Microsoft SQL Server, and IBM DB2. Even on other databases, though (and on the original databases, as new releases bring change), the vendor-independent core of this book will still apply. As such, this book is fairly universal and timeless, as computer science texts go. I have used the method at the core of this book for 10 years, on four different vendors’ databases, and I expect it to apply for at least another 10 years. You can always use your own vendor’s current documentation (usually available online) to review the comparatively simple, release-dependent, vendor-specific techniques for viewing and controlling execution plans.

Why Tune SQL?
Let’s begin with a basic question: should someone tune the SQL in an application, and is that someone you? Since you are reading this book, your answer is at least moderately inclined to the positive side. Since it took me several years to appreciate just how positive my own answer to this question should be, though, this chapter lays my own viewpoint on the table as an example.

Let’s describe your application, sight-unseen, from an admittedly datacentric point of view: it exists to allow human beings or possibly another application to see, and possibly to enter and manipulate, in a more or less massaged form, data that your organization stores in a relational database. On the output data, it performs manipulations like addition, multiplication, counting, averaging, sorting, and formatting, operations such as those you would expect to see in a business spreadsheet. It does not solve differential equations or do any other operations in which you might perform billions of calculations even on a compact set of inputs. The work the application must do after it gets data out of the database, or before it puts data into the database, is modest by modern computing standards, because the data volumes handled outside of the database are modest, and the outside-the-database calculation load per datapoint is modest.

Online applications and applications that produce reports for human consumption should produce data volumes fit for human consumption, which are paltry for a computer to handle. Middleware, moving data from one system to another without human intervention, can handle higher data volumes, but even middleware usually performs some sort of aggregation function, reducing data volumes to comparatively
modest levels.

Even if the vast number of end users leads to high calculation loads outside the database, you can generally throw hardware at the application load (the load outside the database, that is), hanging as many application servers as necessary off the single central database. (This costs money, but I assume that a system to support, say, 50,000 simultaneous end users is supported by a substantial budget.)

On the other hand the database behind a business application often examines millions of rows in the database just to return the few rows that satisfy an application query, and this inefficiency can completely dominate the overall system load and performance. Furthermore, while you might easily add application servers, it is usually much harder to put multiple database servers to work on the same consistent set of business data for the same application, so throughput limits on the database server are much more critical. It is imperative to make your system fit your business volumes, not the other way around

Apart from these theoretical considerations, my own experience in over 13 years of performance and tuning, is that the database—more specifically, the SQL from the application—is the best place to look for performance and throughput improvements.

Improvements to SQL performance tend to be the safest changes you can make to an application, least likely to break the application somewhere else, and they help both performance and throughput, with no hardware cost or minimal cost at worst (in the case of added indexes, which require disk space). I hope that by the end of this book you will also be persuaded that the labor cost of tuning SQL is minimal, given expertise in the method this book describes. The benefit-to-cost ratio is so high that all significan database-based applications should have their high-load SQL tuned.

Customer reviews

There are no customer reviews yet.
Share your thoughts with other customers

Most helpful customer reviews on 4.5 out of 5 stars 26 reviews
5.0 out of 5 starsShould be required reading for anyone writing a database professionally
26 October 2015 - Published on
Verified Purchase
One person found this helpful.
Kevin Meade
4.0 out of 5 starsThis Old Dog learned a new trick
28 June 2010 - Published on
Verified Purchase
15 people found this helpful.
5.0 out of 5 starsRead this little gem !
1 November 2016 - Published on
Verified Purchase
Leonard Wofford
5.0 out of 5 starsAnother great O'Reilly book
20 May 2016 - Published on
Verified Purchase
Amazon Customer
5.0 out of 5 starsVery good tuning tips
8 September 2016 - Published on
Verified Purchase

Where's My Stuff?

Delivery and Returns

Need Help?