CARVIEW |
The Art of SQL
- By
- Stephane Faroult, Peter Robson
- Publisher:
- O'Reilly Media
- Released:
- March 2006
- Pages:
- 368
Enterprises throughout the world are confronted with exploding volumes of data, and many IT departments are looking for quick solutions. This insightful book demonstrates that since SQL code may run for 5 to 10 years, and run on different hardware, it must be fast and sound from the start. Expert authors Stephane Faroult and Peter Robson offer SQL best practices and relational theory that force you to focus on strategy rather than specifics.
For all the buzz about trendy IT techniques, data processing is still at the core of our systems, especially now that enterprises all over the world are confronted with exploding volumes of data. Database performance has become a major headache, and most IT departments believe that developers should provide simple SQL code to solve immediate problems and let DBAs tune any "bad SQL" later.
In The Art of SQL, author and SQL expert Stephane Faroult argues that this "safe approach" only leads to disaster. His insightful book, named after Art of War by Sun Tzu, contends that writing quick inefficient code is sweeping the dirt under the rug. SQL code may run for 5 to 10 years, surviving several major releases of the database management system and on several generations of hardware. The code must be fast and sound from the start, and that requires a firm understanding of SQL and relational theory.
The Art of SQL offers best practices that teach experienced SQL users to focus on strategy rather than specifics. Faroult's approach takes a page from Sun Tzu's classic treatise by viewing database design as a military campaign. You need knowledge, skills, and talent. Talent can't be taught, but every strategist from Sun Tzu to modern-day generals believed that it can be nurtured through the experience of others. They passed on their experience acquired in the field through basic principles that served as guiding stars amid the sound and fury of battle. This is what Faroult does with SQL.
Like a successful battle plan, good architectural choices are based on contingencies. What if the volume of this or that table increases unexpectedly? What if, following a merger, the number of users doubles? What if you want to keep several years of data online? Faroult's way of looking at SQL performance may be unconventional and unique, but he's deadly serious about writing good SQL and using SQL well. The Art of SQL is not a cookbook, listing problems and giving recipes. The aim is to get you-and your manager-to raise good questions.
-
Chapter 1 Laying Plans
-
The Relational View of Data
-
The Importance of Being Normal
-
To Be or Not to Be, or to Be Null
-
Qualifying Boolean Columns
-
Understanding Subtypes
-
Stating the Obvious
-
The Dangers of Excess Flexibility
-
The Difficulties of Historical Data
-
Design and Performance
-
Processing Flow
-
Centralizing Your Data
-
System Complexity
-
The Completed Plans
-
-
Chapter 2 Waging War
-
Query Identification
-
Stable Database Connections
-
Strategy Before Tactics
-
Problem Definition Before Solution
-
Stable Database Schema
-
Operations Against Actual Data
-
Set Processing in SQL
-
Action-Packed SQL Statements
-
Profitable Database Accesses
-
Closeness to the DBMS Kernel
-
Doing Only What Is Required
-
SQL Statements Mirror Business Logic
-
Program Logic into Queries
-
Multiple Updates at Once
-
Careful Use of User-Written Functions
-
Succinct SQL
-
Offensive Coding with SQL
-
Discerning Use of Exceptions
-
-
Chapter 3 Tactical Dispositions
-
The Identification of "Entry Points"
-
Indexes and Content Lists
-
Making Indexes Work
-
Indexes with Functions and Conversions
-
Indexes and Foreign Keys
-
Multiple Indexing of the Same Columns
-
System-Generated Keys
-
Variability of Index Accesses
-
-
Chapter 4 Maneuvering
-
The Nature of SQL
-
Five Factors Governing the Art of SQL
-
Filtering
-
-
Chapter 5 Terrain
-
Structural Types
-
The Conflicting Goals
-
Considering Indexes as Data Repositories
-
Forcing Row Ordering
-
Automatically Grouping Data
-
The Double-Edged Sword of Partitioning
-
Partitioning and Data Distribution
-
The Best Way to Partition Data
-
Pre-Joining Tables
-
Holy Simplicity
-
-
Chapter 6 The Nine Situations
-
Small Result Set, Direct Specific Criteria
-
Small Result Set, Indirect Criteria
-
Small Intersection of Broad Criteria
-
Small Intersection, Indirect Broad Criteria
-
Large Result Set
-
Self-Joins on One Table
-
Result Set Obtained by Aggregation
-
Simple or Range Searching on Dates
-
Result Set Predicated on Absence of Data
-
-
Chapter 7 Variations in Tactics
-
Tree Structures
-
Representing Trees in an SQL Database
-
Practical Implementation of Trees
-
Walking a Tree with SQL
-
Aggregating Values from Trees
-
-
Chapter 8 Weaknesses and Strengths
-
Deceiving Criteria
-
Abstract Layers
-
Distributed Systems
-
Dynamically Defined Search Criteria
-
-
Chapter 9 Multiple Fronts
-
The Database Engine as a Service Provider
-
Concurrent Data Changes
-
-
Chapter 10 Assembly of Forces
-
Increasing Volumes
-
Data Warehousing
-
-
Chapter 11 Stratagems
-
Turning Data Around
-
Querying with a Variable in List
-
Aggregating by Range (Bands)
-
Superseding a General Case
-
Selecting Rows That Match Several Items in a List
-
Finding the Best Match
-
Optimizer Directives
-
-
Chapter 12 Employment of Spies
-
The Database Is Slow
-
The Components of Server Load
-
Defining Good Performance
-
Thinking in Business Tasks
-
Execution Plans
-
Using Execution Plans Properly
-
What Really Matters?
-
-
PHOTO CREDITS
-
About the Author

- Title:
- The Art of SQL
- By:
- Stephane Faroult, Peter Robson
- Publisher:
- O'Reilly Media
- Formats:
-
- Ebook
- Safari Books Online
- Print Release:
- March 2006
- Ebook Release:
- December 2008
- Pages:
- 368
- Print ISBN:
- 978-0-596-00894-9
- | ISBN 10:
- 0-596-00894-5
- Ebook ISBN:
- 978-0-596-15971-9
- | ISBN 10:
- 0-596-15971-4
-
Stephane Faroult
Stephane Faroult first discovered relational databases and the SQL language back in 1983. He joined Oracle France in their early days (after a brief spell with IBM and a bout of teaching at the University of Ottawa) and soon developed an interest in performance and tuning topics. After leaving Oracle in 1988, he briefly tried to reform and did a bit of operational research, but after one year, he succumbed again to relational databases. He has been continuously performing database consultancy since then, and founded RoughSea Ltd in 1998.
-
Peter Robson
Graduated in geology from Durham University (1968), then taught at Edinburgh University, obtaining an M.Phil in geology 1975. Worked in Greece as a geologist (1973,74), and then in University of Newcastle specialising in geological databases. Joined the British Geological Survey 1980, and has steered the organisations' use of database ever since, as data architect and database administrator. Has worked with databases since 1977, relational databases since 1981, and Oracle since 1985. He has lectured widely in the UK on geological aspects of database and has specialised on aspects of the SQL system as well as data modelling from the corporate architecture down to the departmental level. He has presented at various Oracle database conferences both in the UK, Europe and North America. Currently a director on the board of the UK Oracle Users Group.
![]() ©2010, O'Reilly Media, Inc. (707) 827-7000 / (800) 998-9938 All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. |
About O'Reilly
Academic Solutions Authors Contacts Customer Service Jobs Newsletters O'Reilly Labs Press Room Privacy Policy RSS Feeds Terms of Service User Groups Writing for O'Reilly |
Content Archive Business Technology Computer Technology Microsoft Mobile Network Operating System Digital Photography Programming Software Web Web Design |
More O'Reilly Sites
O'Reilly Radar Ignite Tools of Change for Publishing Digital Media Inside iPhone makezine.com craftzine.com hackszine.com perl.com xml.com Partner Sites InsideRIA java.net O'Reilly Insights on Forbes.com |