SQL Tuning (Paperback)
暫譯: SQL 調優 (平裝本)

Dan Tow

  • 出版商: O'Reilly
  • 出版日期: 2003-12-23
  • 售價: $1,590
  • 貴賓價: 9.5$1,511
  • 語言: 英文
  • 頁數: 338
  • 裝訂: Paperback
  • ISBN: 0596005733
  • ISBN-13: 9780596005733
  • 相關分類: SQL
  • 已過版

買這商品的人也買了...

商品描述

 

Summary

A poorly performing database application not only costs users time, but also has an impact on other applications running on the same computer or the same network. SQL Tuning provides an essential next step for SQL developers and database administrators who want to extend their SQL tuning expertise and get the most from their database applications.

There are two basic issues to focus on when tuning SQL: how to find and interpret the execution plan of an SQL statement and how to change SQL to get a specific alternate execution plan. SQL Tuning provides answers to these questions and addresses a third issue that's even more important: how to find the optimal execution plan for the query to use.

Author Dan Tow outlines a timesaving method he's developed for finding the optimum execution plan--rapidly and systematically--regardless of the complexity of the SQL or the database platform being used. You'll learn how to understand and control SQL execution plans and how to diagram SQL queries to deduce the best execution plan for a query. Key chapters in the book include exercises to reinforce the concepts you've learned. SQL Tuning concludes by addressing special concerns and unique solutions to "unsolvable problems."

Whether you are a programmer who develops SQL-based applications or a database administrator or other who troubleshoots poorly tuned applications, SQL Tuning will arm you with a reliable and deterministic method for tuning your SQL queries to gain optimal performance.

Table of Contents

Foreword

Preface

1. Introduction

     Why Tune SQL?

     Who Should Tune SQL?

     How This Book Can Help

     A Bonus

     Outside-the-Box Solutions

2. Data-Access Basics

     Caching in the Database

     Tables

     Indexes

     Uncommon Database Objects

     Single-Table Access Paths

     Calculating Selectivity

     Joins

3. Viewing and Interpreting Execution Plans

     Reading Oracle Execution Plans

     Reading DB2 Execution Plans

     Reading SQL Server Execution Plans

4. Controlling Execution Plans

     Universal Techniques for Controlling Plans

     Controlling Plans on Oracle

     Controlling Plans on DB2

     Controlling Plans on SQL Server

5. Diagramming Simple SQL Queries

     Why a New Method?

     Full Query Diagrams

     Interpreting Query Diagrams

     Simplified Query Diagrams

     Exercises

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

7. Diagramming and Tuning Complex SQL Queries

     Abnormal Join Diagrams

     Queries with Subqueries

     Queries with Views

     Queries with Set Operations

     Exercise

8. Why the Diagramming Method Works

     The Case for Nested Loops

     Choosing the Driving Table

     Choosing the Next Table to Join

     Summary

9. Special Cases

     Outer Joins

     Merged Join and Filter Indexes

     Missing Indexes

     Unfiltered Joins

     Unsolvable Problems

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

A. Exercise Solutions

B. The Full Process, End to End

Glossary

Index

商品描述(中文翻譯)

摘要

表現不佳的資料庫應用程式不僅會浪費使用者的時間,還會影響同一台電腦或同一網路上運行的其他應用程式。《SQL Tuning》為希望擴展其 SQL 調優專業知識並充分利用其資料庫應用程式的 SQL 開發人員和資料庫管理員提供了必要的下一步。

在調優 SQL 時,有兩個基本問題需要關注:如何找到並解釋 SQL 語句的執行計劃,以及如何更改 SQL 以獲得特定的替代執行計劃。《SQL Tuning》提供了這些問題的答案,並解決了一個更重要的第三個問題:如何找到查詢的最佳執行計劃。

作者 Dan Tow 概述了一種他所開發的節省時間的方法,用於快速且系統性地找到最佳執行計劃,無論 SQL 的複雜性或所使用的資料庫平台如何。您將學會如何理解和控制 SQL 執行計劃,以及如何繪製 SQL 查詢圖以推導查詢的最佳執行計劃。本書中的關鍵章節包括加強您所學概念的練習。《SQL Tuning》最後針對「無法解決的問題」提出特殊關注和獨特解決方案。

無論您是開發基於 SQL 的應用程式的程式設計師,還是負責排除調優不佳的應用程式問題的資料庫管理員或其他人,《SQL Tuning》都將為您提供一種可靠且確定性的方法,以調優您的 SQL 查詢以獲得最佳性能。

目錄

前言

序言

1. 介紹
為什麼要調優 SQL?
誰應該調優 SQL?
本書如何幫助您
一個額外的獎勵
創新的解決方案

2. 資料存取基礎
資料庫中的快取
表格
索引
不常見的資料庫物件
單表存取路徑
計算選擇性
連接

3. 查看和解釋執行計劃
讀取 Oracle 執行計劃
讀取 DB2 執行計劃
讀取 SQL Server 執行計劃

4. 控制執行計劃
控制計劃的通用技術
在 Oracle 上控制計劃
在 DB2 上控制計劃
在 SQL Server 上控制計劃

5. 繪製簡單的 SQL 查詢
為什麼需要新方法?
完整查詢圖
解釋查詢圖
簡化查詢圖
練習

6. 推導最佳執行計劃
穩健的執行計劃
標準啟發式連接順序
簡單範例
特殊案例
複雜範例
特殊案例的特殊規則
練習

7. 繪製和調優複雜的 SQL 查詢
異常連接圖
包含子查詢的查詢
包含視圖的查詢
包含集合操作的查詢
練習

8. 為什麼繪圖方法有效
嵌套迴圈的案例
選擇驅動表
選擇下一個要連接的表
總結

9. 特殊案例
外部連接
合併連接和過濾索引
缺失的索引
未過濾的連接
無法解決的問題

10. 對看似無法解決的問題的創新解決方案
當非常快不夠快時
返回過多行的查詢
調優的查詢返回少量行,速度緩慢

A. 練習解答

B. 完整過程,從頭到尾

詞彙表

索引