-
Chapter 1 Introduction
-
Why Tune SQL?
-
Who Should Tune SQL?
-
How This Book Can Help
-
A Bonus
-
Outside-the-Box Solutions
-
-
Chapter 2 Data-Access Basics
-
Caching in the Database
-
Tables
-
Indexes
-
Uncommon Database Objects
-
Single-Table Access Paths
-
Calculating Selectivity
-
Joins
-
-
Chapter 3 Viewing and Interpreting Execution Plans
-
Reading Oracle Execution Plans
-
Reading DB2 Execution Plans
-
Reading SQL Server Execution Plans
-
-
Chapter 4 Controlling Execution Plans
-
Universal Techniques for Controlling Plans
-
Controlling Plans on Oracle
-
Controlling Plans on DB2
-
Controlling Plans on SQL Server
-
-
Chapter 5 Diagramming Simple SQL Queries
-
Why a New Method?
-
Full Query Diagrams
-
Interpreting Query Diagrams
-
Simplified Query Diagrams
-
Exercises (See Section A.1 for the solution to each exercise.)
-
-
Chapter 6 Deducing the Best Execution Plan
-
Robust Execution Plans
-
Standard Heuristic Join Order
-
Simple Examples
-
A Special Case
-
A Complex Example
-
Special Rules for Special Cases
-
Exercise (See Section A.2 for the solution to the exercise.)
-
-
Chapter 7 Diagramming and Tuning Complex SQL Queries
-
Abnormal Join Diagrams
-
Queries with Subqueries
-
Queries with Views
-
Queries with Set Operations
-
Exercise (See Section A.3 for the solution to the exercise.)
-
-
Chapter 8 Why the Diagramming Method Works
-
The Case for Nested Loops
-
Choosing the Driving Table
-
Choosing the Next Table to Join
-
Summary
-
-
Chapter 9 Special Cases
-
Outer Joins
-
Merged Join and Filter Indexes
-
Missing Indexes
-
Unfiltered Joins
-
Unsolvable Problems
-
-
Chapter 10 Outside-the-Box Solutions to Seemingly Unsolvable Problems
-
When Very Fast Is Not Fast Enough
-
Queries that Return Data from Too Many Rows
-
Tuned Queries that Return Few Rows, Slowly
-
-
Appendix A Exercise Solutions
-
Chapter 5 Exercise Solutions
-
Chapter 6 Exercise Solution
-
Chapter 7 Exercise Solution
-
-
Appendix B The Full Process, End to End
-
Reducing the Query to a Query Diagram
-
Solving the Query Diagram
-
Checking the Execution Plans
-
Altering the Database to Enable the Best Plan
-
Altering the SQL to Enable the Best Plan
-
Altering the Application
-
Putting the Example in Perspective
-
-
Glossary
-
Colophon
- Title:
- SQL Tuning
- By:
- Dan Tow
- Publisher:
- O'Reilly Media
- Formats:
-
- Ebook
- Safari Books Online
- Print Release:
- November 2003
- Ebook Release:
- February 2009
- Pages:
- 336
- Print ISBN:
- 978-0-596-00573-3
- | ISBN 10:
- 0-596-00573-3
- Ebook ISBN:
- 978-0-596-10417-7
- | ISBN 10:
- 0-596-10417-0
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of SQL Tuning is a salamander. Though mature salamanders bear a superficial resemblance to small lizards, salamanders are not reptiles; rather, they are amphibians that retain their tails as adults. Like all amphibians, a salamander begins life underwater as a gelatinous egg and develops through a series of stages. Newly hatched salamander larvae resemble tadpoles (the larval form of toads and frogs) and breathe through gills. As they mature, salamanders develop legs and lungs, which allow them to leave the water and breathe air. But they remain in or around streams, rivers, ponds, lakes, or moist woodlands throughout their lives. They must return to a freshwater source to lay their eggs.
The most immediately recognizable difference between adult salamanders and lizards is the former's lack of scales; a salamander's skin is smooth and porous and is used to absorb moisture. Salamanders' skin can be any of a variety of colors--from brown or black to yellow or red-- and is often covered with dark spots, bars, or stripes. As they grow, salamanders molt their skin, usually every few days or every few weeks. Salamanders also have the ability to shed and regrow their tails and other parts of their body that become severed or damaged. Unlike other amphibians, salamanders are carnivorous at every stage of their life cycle (tadpoles are herbivorous), and their diet consists of worms, insects, snails, and small fish.
Mature salamanders are usually about 4 to 8 inches long, though they can be as short as 2 inches and as long as 70 inches. Most have four legs, though some have only two forelegs. Their front feet each have four clawless toes, while hind feet, when present, have five toes. Salamanders are nocturnal and usually divide their time between the land and water, though some live exclusively in the water and a few are purely landdwelling. When they swim, they make little use of their limbs. Instead, they use their laterally compressed (i.e., taller than it is wide) tail and muscle contraction to propel themselves through the water, as eels do. Some tree-dwelling salamanders have prehensile tails, which they can use to grasp branches.
The name salamander (from the Greek salamandra) originally applied to a legendary creature that could live in and extinguish fire. Aristotle is largely responsible for perpetuating this myth; in his History of Animals, he supports the story that the salamander "not only walks through the fire but puts it out in doing so." The application of the name salamander to an actual amphibian was first recorded in 1611, at which time the supernatural characteristics of the mythological animal became attributed to the actual animal. The common belief (mistaken, of course) that salamanders can endure fire persisted well into the 19th century. Brian Sawyer was the production editor and copyeditor for SQL Tuning. Matt Hutchinson was the proofreader. Darren Kelly and Claire Cloutier provided quality control. Angela Howard wrote the index.
Ellie Volckhausen designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from the Dover Pictorial Archive. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe's ITC Garamond font.
Melanie Wang designed the interior layout, based on a series design by David Futato. This book was converted by Julie Hawks to FrameMaker 5.5.6 with a format conversion tool created by Erik Ray, Jason McIntosh, Neil Walls, and Mike Sierra that uses Perl and XML technologies. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSans Mono Condensed. The illustrations that appear in the book were produced by Robert Romano and Jessamyn Read using Macromedia FreeHand 9and Adobe Photoshop 6. The tip and warning icons were drawn by Christopher Bing. This colophon was written by Brian Sawyer.
