Performance Tuning with SQL Server Dynamic Management Views (High Performance SQL Server) ペーパーバック – 2010/9/1
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
Dynamic Management Views (DMVs) are a significant and valuable addition to the DBA's troubleshooting armory, laying bare previously unavailable information regarding the under-the-covers activity of your database sessions and transactions. Why, then, aren't all DBAs using them? Why do many DBAs continue to ignore them in favour of tried and trusted tools such as sp_who2, DBCC OPENTRAN, and so on, or make do with the ready made reports built into SSMS? Why do even those that do use the DMVs speak wistfully about good old sysprocesses? There seem to be two main factors at work. Firstly, some DBAs are simply unaware of the depth and breadth of the information that is available from the DMvs, or how it might help them troubleshoot common issues. This book investigates all of the DMVs that are most frequently useful to the DBA in investigating query execution, index usage, session and transaction activity, disk IO, and how SQL Server is using or abusing the operating system. Secondly, the DMVs have a reputation of being difficult to use. In the process of exposing as much useful data as possible, sysprocesses has been de-normalized, and many new views and columns have been added. This fact, coupled with the initially-baffling choices of what columns will be exposed where, has lead to some DBAs to liken querying DMVs to collecting mystic spells. In fact, however, once you start to write your own scripts, you'll see the same tricks, and similar join patterns, being used time and again. As such, a relatively small core set of scripts can be readily adapted to suit any requirement. This book is here to de-mystify the process of collecting the information you need to troubleshoot SQL Server problems. It will highlight the core techniques and patterns that you need to master, and will provide a core set of scripts that you can use and adapt for your own systems, including how to: * Root out the queries that are causing memory or CPU pressure on your system * Investigate caching, and query plan reuse * Identify index usage patterns * Track fragmentation in clustered indexes and heaps * Get full details on blocking and blocked transactions, including the exact commands being executed, and by whom. * Find out where SQL Server is spending time waiting for resources to be released, before proceeding * Monitor usage and growth of tempdb The DMVs don't make existing, built-in, performance tools obsolete. On the contrary, they complement these tools, and offer a flexibility, richness and granularity that are simply not available elsewhere. Furthermore, you don't need to master a new GUI, or a new language in order to use them; it's all done in a language all DBAs know and mostly love: T-SQL.
Performance Tuning with SQL Server Dynamic Management Views is not a beginner level book, and it assumes knowledge of SQL Server and RDBMS technologies. Along the way there are recommendations for online articles to read for more in-depth information, or for background coverage of concepts that you may not have seen in a while and need to review. Unlike some technical books on SQL Server, this is not a regurgitation of SQL Server Books Online, however it does point you there for more information when appropriate.
This book works in layers, so that you have a structure to approaching performance tuning by starting at an outer layer and working toward inner layers as the book progresses. Topics to be measured by dynamic management views (eg. transactions, latches) are briefly discussed as encountered. Rather than just blindly querying dynamic management views, the authors describe how to filter and display results in a useful manner. They also discuss pitfalls to avoid when using dynamic management objects... for example, they will mention if a particular dynamic management view may be resource intensive, things to do so that joins on dynamic management views are properly constructed, etc.
The authors do not consider dynamic management objects in isolation. They make comparisons to alternative measurement methods and tool, and discuss advantages of dynamic management objects to consider (for example, the system impacts of measurement methods, available levels of granularity). They also discuss when other tools might be appropriate, or how other tools and dynamic management objects might be used together to address performance issues.
This book describes the naming of dynamic management objects, and clarifies these names so that you can begin to get a feel for what a dynamic management object does based on the structure of its name. It also compares dynamic management objects among each other to avoid confusion... this is appreciated because a lot of the names can begin to look similar after a while. Dynamic management objects are also compared and contrasted to older SQL Server compatibility views. This way, you know where to go for information you were accustomed to getting from those older views. Along these same lines, the book discusses name changes of columns that are available in dynamic management objects but with a different name than was used in compatibility views.
The book is full of good examples, and many of these set up scenarios in a database so that you can observe the resulting issues using dynamic management objects. Code examples in the book are available for download online (link for this is provided early in the book). Performance Tuning with SQL Server Dynamic Management Views is dense with information and hard to put down once you open it. It will be nearby with my other technical reference books, and I'm sure I'll be referring to it often in the coming years.
I really like the approach the authors, Louis Davidson & Tim Ford, took to the book. Instead of just laying out a bunch of Dynamic Management Objects (DMO) in alphabetical order or something, they focused on the DMOs associated with Performance Tuning. Then, they took the trouble to break the DMOs apart into different areas of data and performance metrics like "Query Plan MetaData" and "Transactions." They introduced each topic with an overview of the topic, why DMOs are useful to gathering data on that topic and then dived into which DMO did what to help you with the information you need to do performance tuning on your system.
The writing is very clear and to the point. Also, I wasn't able to detect different "voices" as I read through the book. Despite more than one author, there's not that disjointed feeling you can get as you hop from one chapter to another and switch authors at the same time. I really liked the sample queries and the way they built on each other, showing you the true strength available in DMOs, which is combining them to put together extremely useful views on the data in the system. I also liked the fonts used and the layout of the book, the way important code was called out through bolding & font changes. I did think that the screen captures were a bit fuzzy, but not to the degree that it detracted from the book in any way.
The argument can be made that books like this just rewrite the Books Online (BOL). But, in addition to extremely clear explanations, and a focused methodology showing you not just how to use the DMOs but where and why to use the DMOs, you also get the unique code samples. The thing about DMOs is that in isolation, they're useful. But it's in combination that they become powerful. The examples emphasize how these building blocks can be put together to create new, interesting and useful reports. Examples such as these are just not available in BOL.
For all these reasons, I highly recommend this book. If you're responsible for maintaining or developing SQL Server systems, you'll find something useful in this book that you can put to work, right away.