📘

Pages

744

Published

2013

SQL ✨ New

SQL Success

SQL query design and performance thinking for working database professionals

Write SQL that is correct by design, fast under load, and maintainable by the next person who reads it.

SQL Success by Stéphane Faroult is a thorough, practitioner-focused treatment of SQL query design and database performance. It moves beyond syntax tutorials to address how experienced developers and analysts should think about queries: how the database engine reads your intent, where performance quietly collapses, and how to write SQL that holds up in production. At 744 pages, it covers relational reasoning, query structure, indexing strategy, and execution plan analysis with the rigour that intermediate-to-advanced readers need.

About this book

Most SQL books stop at syntax. SQL Success starts where those books end. Stéphane Faroult, whose earlier work on Oracle performance has been cited by database professionals for years, turns his attention to SQL as a discipline: not a string you paste into an application, but a language with a precise relational model underneath it, one that rewards careful thinking and punishes sloppiness at scale.

The book is built around a central argument: most slow, fragile, or incorrect SQL is slow, fragile, or incorrect for structural reasons, not missing index reasons. Understanding why the relational model works the way it does changes how you write every query. Faroult makes that argument concrete with worked examples, annotated execution plans, and before-and-after rewrites drawn from the kinds of problems that appear in real production systems.

You will work through topics including:

  • Relational thinking and set-based reasoning as the foundation of correct SQL
  • Query structure decisions that affect both readability and optimizer behaviour
  • Indexes, statistics, and how the engine uses them to build execution plans
  • Common query patterns that appear fast in development and fail in production
  • Aggregation, subqueries, joins, and window functions approached from a performance perspective
  • Diagnostics: reading execution plans and identifying the real bottleneck

The treatment is database-agnostic where the principles apply universally, and vendor-specific where they need to be. Whether you are on PostgreSQL, Oracle, SQL Server, or MySQL, the reasoning transfers.

This is not a book for someone learning SQL for the first time. It is for the developer or analyst who already writes SQL every day and wants to understand why some queries work and others quietly cost the business money. At 744 pages, it is a reference you return to, not a weekend read you shelve after one pass.

🎯 What you'll learn

  • Reason from the relational model to write queries that are correct before you worry about performance
  • Predict how the query optimizer will interpret a given query structure and adjust accordingly
  • Diagnose slow queries using execution plans rather than guessing at missing indexes
  • Rewrite common anti-patterns, including correlated subqueries and implicit conversions, into forms the engine can execute efficiently
  • Choose join types, aggregation strategies, and window functions with execution cost in mind
  • Evaluate index designs against realistic query workloads rather than individual queries in isolation
  • Apply these principles consistently across the major relational database platforms

👤 Who is this book for?

  • Backend developers who write SQL regularly and want to understand what the query optimizer actually does with their queries
  • Database administrators looking for a rigorous treatment of query design to complement their operational knowledge
  • Data analysts who have moved beyond basic SELECT statements and need to write performant queries against large datasets
  • Application developers debugging slow queries in production who want a framework for diagnosis, not just a list of tips
  • Senior engineers preparing for schema design or performance review work who need to reason from first principles

Table of contents

  1. 01

    The Relational Foundation

    Establishes the set-based reasoning and relational model principles that underpin every query design decision in the book. You will learn to think in relations before writing a single line of SQL.

  2. 02

    Query Structure and Readability

    Examines how formatting, clause ordering, and structural choices affect not just human readability but also how the optimizer parses intent. You will rewrite poorly structured queries and trace the consequences on execution plans.

  3. 03

    Joins and Their Costs

    Covers inner joins, outer joins, cross joins, and semi-joins from a performance perspective, explaining how join order and cardinality estimates interact. You will practise choosing join types based on data shape rather than habit.

  4. 04

    Subqueries, CTEs, and Derived Tables

    Compares correlated subqueries, uncorrelated subqueries, CTEs, and derived tables as interchangeable structures with different execution profiles. You will identify when each form helps the optimizer and when it hinders it.

  5. 05

    Aggregation and Window Functions

    Works through GROUP BY, HAVING, and the full family of window functions, focusing on where aggregation happens in the execution plan and how to push it to the right stage. You will rewrite aggregation-heavy queries to reduce intermediate row counts.

  6. 06

    Indexes, Statistics, and the Optimizer

    Explains how the query optimizer uses index metadata and column statistics to build execution plans, and what happens when those statistics are stale or misleading. You will design indexes against realistic query workloads and verify the result in execution plans.

  7. 07

    Reading Execution Plans

    Provides a systematic method for reading and interpreting execution plans across the major database platforms. You will work through annotated plans for realistic queries and identify the node that is actually causing the performance problem.

  8. 08

    Production Patterns and Anti-Patterns

    Catalogues the query patterns that pass code review and fail under load, including implicit type conversions, functions on indexed columns, and row-by-row processing disguised as SQL. You will apply fixes grounded in the principles from every earlier chapter.

Frequently asked questions

Do I need to know SQL already to get value from this book?

Yes. SQL Success assumes you are already writing SQL in a professional context. It is not a beginner tutorial. Readers who are comfortable with SELECT, JOIN, GROUP BY, and subqueries will get the most from it.

Is the book tied to a specific database platform?

No. The core principles are platform-agnostic. Where behaviour differs materially between PostgreSQL, Oracle, SQL Server, and MySQL, Faroult addresses the differences explicitly.

Is a 2013 book still relevant for modern SQL work?

The relational model and optimizer fundamentals this book teaches have not changed. Specific syntax details for newer window function variants or platform features may need cross-referencing with current documentation, but the reasoning and diagnostic methods are as applicable today as when the book was published.

Does the book include code examples or downloadable files?

The book contains extensive worked SQL examples throughout the text. Check the publisher's page for any companion materials available for download.

Who is this book not for?

It is not suitable for readers who are new to SQL or databases. It is also not a DBA administration handbook covering backups, replication, or server configuration. The focus is entirely on query design and performance.

You might also like

📬 Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.