SQL Server DMVs in Action pptx

355 864 0
SQL Server DMVs in Action pptx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

MANNING Ian W. Stirk Better queries with Dynamic Management Views www.it-ebooks.info SQL Server DMVs in Action www.it-ebooks.info www.it-ebooks.info SQL Server DMVs in Action BETTER QUERIES WITH DYNAMIC MANAGEMENT VIEWS IAN W. STIRK MANNING Shelter Island www.it-ebooks.info For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 261 Shelter Island, NY 11964 Email: orders@manning.com ©2011 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editor: Katharine Osborne 20 Baldwin Road Copyeditor: Linda Recktenwald PO Box 261 Proofreader: Katie Tennant Shelter Island, NY 11964 Typesetter: Dennis Dalinnik Cover designer: Marija Tudor ISBN: 9781935182733 Printed in the United States of America 12345678910 –MAL–17161514131211 www.it-ebooks.info To Joan, Karen, and Catherine, for yesterday, today, and tomorrow www.it-ebooks.info www.it-ebooks.info vii brief contents PART 1 STARTING THE JOURNEY. 1 1 ■ The Dynamic Management Views gold mine 3 2 ■ Common patterns 31 PART 2 DMV DISCOVERY 53 3 ■ Index DMVs 55 4 ■ Improving poor query performance 92 5 ■ Further query improvements 118 6 ■ Operating system DMVs 147 7 ■ Common Language Runtime DMVs 174 8 ■ Resolving transaction issues 196 9 ■ Database-level DMVs 226 10 ■ The self-healing database 257 11 ■ Useful scripts 285 www.it-ebooks.info www.it-ebooks.info ix contents preface xix acknowledgements xx about this book xxii PART 1 STARTING THE JOURNEY 1 1 The Dynamic Management Views gold mine 3 1.1 What are Dynamic Management Views? 4 A glimpse into SQL Server’s internal data 7 Aggregated results 8 ■ Impact of running DMVs 8 Part of SQL Server 2005 onward 8 1.2 The problems DMVs can solve 9 Diagnosing problems 9 ■ Performance tuning 10 Monitoring 10 1.3 DMV examples 13 Find your slowest queries 14 ■ Find those missing indexes 15 ■ Identify what SQL statements are running now 17 ■ Quickly find a cached plan 18 1.4 Preparing to use DMVs 22 Permissions 22 ■ Clearing DMVs 22 www.it-ebooks.info [...]... queue monitors SQL Server Operating System These DMVs contain information relating to various aspects of the SQL Server Operating System (SQLOS), including performance counters, memory pools, schedulers, system information, tasks, threads, wait statistics, waiting tasks, and memory objects Transaction These DMVs contain information relating to various aspects of transactions, including snapshot, database,... performance of your databases SQL Server is finding its way into an increasing number of businesses Although most servers are conspicuous, some appear almost hidden, for example, SharePoint servers and Customer Relationship Management (CRM) servers In addition, increasing amounts of data are getting stored within SQL Server Both of these trends have a bearing on the performance of your SQL Server databases and... character-based data using linguistic searches This can be thought of as a higher-level wildcard search These DMVs contain information relating to various aspects of fulltext search, including existing full-text catalogs, index populations currently occurring, and memory buffers/pools Index These DMVs contain information relating to various aspects of indexes, including missing indexes, index usage (number... High-maintenance indexes The impact ■ 69 Finding the top high-maintenance indexes 69 of high-maintenance indexes 71 3.5 Most-frequently used indexes Finding the most-used indexes of the most-used indexes 74 3.6 Fragmented indexes ■ The impact 72 72 ■ The importance 75 Finding the most-fragmented indexes 75 of fragmented indexes 77 3.7 The impact 65 Finding the most-costly unused indexes 66 of unused indexes... ordinary text Code annotations accompany many of the listings, highlighting important concepts In some cases, numbered bullets link to explanations that follow the listing The source code for all of the examples in the book is available from the publisher’s website at www.manning.com/SQLServerDMVsinAction www.it-ebooks.info ABOUT THIS BOOK xxv Author Online The purchase of SQL Server DMVs in Action includes... Server 2005 onward DMVs and DMFs have been an integral part of SQL Server since version 2005 In SQL Server 2005 there are 89 DMVs (and DMFs), and in SQL Server 2008 there are 136 DMVs With this in mind, this book will concentrate on versions of SQL Server 2005 and higher It’s possible to discover the range of these DMVs by examining their names, by using the following query: SELECT name, type_desc FROM sys.system_objects... aim of improving performance, troubleshooting problems, or gaining a better insight into how SQL Server works DMV information is stored on a per SQL Server instance level You can, however, provide filtering to extract DMV data at varying levels of granularity, including for a given database, table, or query DMV information includes metrics that relate to indexes, query execution, the operating system,... SQL Server compatibility level set to below 2005 An OFFLINE database 50 2.16 Summary 44 50 50 51 PART 2 DMV DISCOVERY .53 3 Index DMVs 3.1 55 The importance of indexes 56 Types of index 56 Types of index access 57 Factors affecting index performance 58 ■ www.it-ebooks.info CONTENTS 3.2 Costly missing indexes xi 62 Finding the most important missing indexes 62 of missing indexes 64 3.3 Unused indexes... efficiently Using the supplied code snippets, developers will be able to ensure appropriate indexes are being used, the data is being retrieved efficiently, and any changes are tested for defined improvement Increasingly, SharePoint servers, CRM servers, and similar servers that have SQL Server as their underlying database are being installed in organizations with little thought for ongoing maintenance... unused indexes 68 3.4 ■ Indexes used by a given routine ■ The impact 78 Finding the indexes used by a given routine 78 The importance of knowing which indexes are used 3.8 Databases with most missing indexes 81 83 Finding which databases have the most missing indexes The importance of other databases 84 3.9 Completely unused indexes 85 Finding which indexes aren’t used at all of unused indexes 87 3.10 Your . MANNING Ian W. Stirk Better queries with Dynamic Management Views www.it-ebooks.info SQL Server DMVs in Action www.it-ebooks.info www.it-ebooks.info SQL Server. indexes 62 Finding the most important missing indexes 62 ■ The impact of missing indexes 64 3.3 Unused indexes 65 Finding the most-costly unused indexes

Ngày đăng: 06/03/2014, 23:21

Từ khóa liên quan

Mục lục

  • Front cover

  • contents

  • preface

  • acknowledgements

  • about this book

    • Who should read this book?

    • Roadmap

    • Code conventions and downloads

    • Author Online

    • About the author

    • About the cover illustration

    • Part 1—Starting the journey

      • The Dynamic Management Views gold mine

        • 1.1 What are Dynamic Management Views?

          • 1.1.1 A glimpse into SQL Server’s internal data

          • 1.1.2 Aggregated results

          • 1.1.3 Impact of running DMVs

          • 1.1.4 Part of SQL Server 2005 onward

          • 1.2 The problems DMVs can solve

            • 1.2.1 Diagnosing problems

            • 1.2.2 Performance tuning

            • 1.2.3 Monitoring

            • 1.3 DMV examples

              • 1.3.1 Find your slowest queries

              • 1.3.2 Find those missing indexes

              • 1.3.3 Identify what SQL statements are running now

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan