Book description
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.
Publisher resources
Table of contents
- Dedication
- Preface
-
1. Laying Plans
- 1.1. The Relational View of Data
- 1.2. The Importance of Being Normal
- 1.3. To Be or Not to Be, or to Be Null
- 1.4. Qualifying Boolean Columns
- 1.5. Understanding Subtypes
- 1.6. Stating the Obvious
- 1.7. The Dangers of Excess Flexibility
- 1.8. The Difficulties of Historical Data
- 1.9. Design and Performance
- 1.10. Processing Flow
- 1.11. Centralizing Your Data
- 1.12. System Complexity
- 1.13. The Completed Plans
-
2. Waging War
- 2.1. Query Identification
- 2.2. Stable Database Connections
- 2.3. Strategy Before Tactics
- 2.4. Problem Definition Before Solution
- 2.5. Stable Database Schema
- 2.6. Operations Against Actual Data
- 2.7. Set Processing in SQL
- 2.8. Action-Packed SQL Statements
- 2.9. Profitable Database Accesses
- 2.10. Closeness to the DBMS Kernel
- 2.11. Doing Only What Is Required
- 2.12. SQL Statements Mirror Business Logic
- 2.13. Program Logic into Queries
- 2.14. Multiple Updates at Once
- 2.15. Careful Use of User-Written Functions
- 2.16. Succinct SQL
- 2.17. Offensive Coding with SQL
- 2.18. Discerning Use of Exceptions
- 3. Tactical Dispositions
- 4. Maneuvering
-
5. Terrain
- 5.1. Structural Types
- 5.2. The Conflicting Goals
- 5.3. Considering Indexes as Data Repositories
- 5.4. Forcing Row Ordering
- 5.5. Automatically Grouping Data
- 5.6. The Double-Edged Sword of Partitioning
- 5.7. Partitioning and Data Distribution
- 5.8. The Best Way to Partition Data
- 5.9. Pre-Joining Tables
- 5.10. Holy Simplicity
-
6. The Nine Situations
- 6.1. Small Result Set, Direct Specific Criteria
- 6.2. Small Result Set, Indirect Criteria
- 6.3. Small Intersection of Broad Criteria
- 6.4. Small Intersection, Indirect Broad Criteria
- 6.5. Large Result Set
- 6.6. Self-Joins on One Table
- 6.7. Result Set Obtained by Aggregation
- 6.8. Simple or Range Searching on Dates
- 6.9. Result Set Predicated on Absence of Data
- 7. Variations in Tactics
- 8. Weaknesses and Strengths
- 9. Multiple Fronts
-
10. Assembly of Forces
- 10.1. Increasing Volumes
- 10.2. Data Warehousing
-
11. Stratagems
- 11.1. Turning Data Around
- 11.2. Querying with a Variable in List
- 11.3. Aggregating by Range (Bands)
- 11.4. Superseding a General Case
- 11.5. Selecting Rows That Match Several Items in a List
- 11.6. Finding the Best Match
- 11.7. Optimizer Directives
- 12. Employment of Spies
- PHOTO CREDITS
- About the Authors
- About the Author
- Copyright
Product information
- Title: The Art of SQL
- Author(s):
- Release date: March 2006
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596008949
You might also like
video
SQL: Beyond the Basics
In this SQL: Beyond the Basics training course, expert author Guy Vaccaro will dive deeper into …
book
SQL in a Nutshell, 3rd Edition
For programmers, analysts, and database administrators, SQL in a Nutshell is the essential reference for the …
book
Getting Started with SQL
Businesses are gathering data today at exponential rates and yet few people know how to access …
book
Effective SQL: 61 Specific Ways to Write Better SQL, First Edition
“Given the authors’ reputations, I expected to be impressed. I was blown away! . . . …