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.
This book discusses Dynamic Management Views (DMVs), troubleshooting tools providing information regarding the under-the-covers activity of database sessions and transactions. It investigates DMVs that are most useful in investigating query execution, index usage, session and transaction activity, disk IO, and how SQL Server is using or abusing the operating system. The book covers the relatively small core set of scripts, using the T-SQL language, which can be readily used and adapted to suit any requirement, including: root out the queries that are causing memory or CPU pressure on a 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; and monitor usage and growth of tempdb. --
Author: Ian W. Stirk
Publisher: Manning Publications Company
Release Date: 2011
Every action in SQL Server - queries, updates, whatever - leaves a set of tiny footprints; SQL Server records all that valuable data and makes it visible through Dynamic Management Views, or DMVs. A DBA or developer can use this incredibly detailed information to significantly improve the performance of queries and better understand what's really going on inside a SQL Server system SQL Server DMVs in Action is a practical guide that shows how to obtain, interpret, and act on the information captured by DMVs to keep SQL Server in top shape. The 100+ samples provided in this book will help readers master DMVs and also give them a tested, working, and instantly reusable SQL code library. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.
Author: Benjamin Nevarez
Publisher: McGraw Hill Professional
Release Date: 2014-10-10
Optimize Microsoft SQL Server 2014 queries and applications Microsoft SQL Server 2014 Query Tuning & Optimization is filled with ready-to-use techniques for creating high-performance queries and applications. The book describes the inner workings of the query processor so you can write better queries and provide the query processor with the quality information it needs to produce efficient execution plans. You’ll also get tips for troubleshooting underperforming queries. In-Memory OLTP (Hekaton), a key new feature of SQL Server 2014, is fully covered in this practical guide. Understand how the query optimizer works Troubleshoot queries using extended events, SQL trace, dynamic management views (DMVs), the data collector, and other tools Work with query operators for data access, joins, aggregations, parallelism, and updates Speed up queries and dramatically improve application performance by creating the right indexes Understand statistics and how to detect and fix cardinality estimation errors Maximize OLTP query performance using In-Memory OLTP (Hekaton) features, including memory-optimized tables and natively compiled stored procedures Monitor and promote plan caching and reuse to improve application performance Improve the performance of data warehouse queries using columnstore indexes Handle query processor limitations with hints and other methods
This book has individual recipes and you can read it from cover to cover or dip into any recipe and get solution to a specific issue. Every recipe is based on a script/procedure explained with step-by-step instructions and screenshots. Concepts are illustrated for better understanding of why one solution performs better than another. SQL Server 2012 Performance Tuning Cookbook is aimed at SQL Server Database Developers, DBAs, and Database Architects who are working in any capacity to achieve optimal performance. However, basic knowledge of SQL Server is expected, but professionals who want to get hands-on with performance tuning and have not worked on tuning the SQL Server for performance will find this book helpful.
Author: Ken Henderson
Publisher: Addison-Wesley Professional
Release Date: 2004
bull; Contains the most depth and breadth of coverage of any book on SQL Server architecture, internals, and tuning bull; Will be a key reference for anyone working with SQL Server, no matter what their skill level bull; The latest book in the bestselling series of Guru's Guides from Ken Henderson
This book describes, diagnoses, and solves the most common problems with SQL Server 2005, 2008, and 2008 R2. The authors explain a basic approach to troubleshooting and the essential tools. They explore areas in which problems arise with regularity: high disk I/O (RAID misconfiguration, inadequate I/O throughput, poor workload distribution, SAN issues, disk partition misalignment); high CPU usage (insufficient memory, poorly written queries, inadequate indexing, inappropriate configuration option settings); memory mismanagement; missing indexes; blocking (caused mainly by poorly designed databases that lack proper keys and indexing, and applications that apply needlessly restrictive transaction isolation levels); deadlocking (Bookmark Lookup, Serializable Range Scan, Cascading Constraint); full transaction logs (lack of log backups, hefty index maintenance operations, long running transaction, problems with replication and mirroring environments); and accidentally-lost data. Finally, the authors discuss diagnosing tools such as the Performance Monitor, Dynamic Management Views, and server-side tracing. --
Author: Tony Davis
Publisher: Red Gate Books
Release Date: 2012
This book provides an understanding of the SQL Server transaction log, what it does and how it works, and its role in ensuring data integrity. Topics covered include: write ahead logging; how to perform transaction log backup and restore in FULL and BULK_LOGGED recovery models; managing log growth, and dealing correctly with an overgrown or full log; and optimizing log throughput and availability, and how to avoid log fragmentation. --
Queries not running fast enough? Wondering about the in-memory database features in 2014? Tired of phone calls from frustrated users? Grant Fritchey’s book SQL Server Query Performance Tuning is the answer to your SQL Server query performance problems. The book is revised to cover the very latest in performance optimization features and techniques, especially including the newly-added, in-memory database features formerly known under the code name Project Hekaton. This book provides the tools you need to approach your queries with performance in mind. SQL Server Query Performance Tuning leads you through understanding the causes of poor performance, how to identify them, and how to fix them. You’ll learn to be proactive in establishing performance baselines using tools like Performance Monitor and Extended Events. You’ll learn to recognize bottlenecks and defuse them before the phone rings. You’ll learn some quick solutions too, but emphasis is on designing for performance and getting it right, and upon heading off trouble before it occurs. Delight your users. Silence that ringing phone. Put the principles and lessons from SQL Server Query Performance Tuning into practice today. Covers the in-memory features from Project Hekaton Helps establish performance baselines and monitor against them Guides in troubleshooting and eliminating of bottlenecks that frustrate users
Design and configure SQL Server instances and databases in support of high-throughput applications that are mission-critical and provide consistent response times in the face of variations in user numbers and query volumes. Learn to configure SQL Server and design your databases to support a given instance and workload. You’ll learn advanced configuration options, in-memory technologies, storage and disk configuration, and more, all toward enabling your desired application performance and throughput. Configuration doesn’t stop with implementation. Workloads change over time, and other impediments can arise to thwart desired performance. High Performance SQL Server covers monitoring and troubleshooting to aid in detecting and fixing production performance problems and minimizing application outages. You'll learn a variety of tools, ranging from the traditional wait analysis methodology to the new query store, and you'll learn how improving performance is really an iterative process. High Performance SQL Server is based on SQL Server 2016, although most of its content can be applied to prior versions of the product. This book is an excellent complement to performance tuning books focusing on SQL queries, and provides the other half of what you need to know by focusing on configuring the instances on which mission-critical queries are executed. Covers SQL Server instance-configuration for optimal performance Helps in implementing SQL Server in-memory technologies Provides guidance toward monitoring and ongoing diagnostics What You Will Learn Understand SQL Server's database engine and how it processes queries Configure instances in support of high-throughput applications Provide consistent response times to varying user numbers and query volumes Design databases for high-throughput applications with focus on performance Record performance baselines and monitor SQL Server instances against them Troubleshot and fix performance problems Who This Book Is For SQL Server database administrators, developers, and data architects. The book is also of use to system administrators who are managing and are responsible for the physical servers on which SQL Server instances are run.
Learn effective and scalable database design techniques in a SQL Server 2016 and higher environment. This book is revised to cover in-memory online transaction processing, temporal data storage, row-level security, durability enhancements, and other design-related features that are new or changed in SQL Server 2016. Designing an effective and scalable database using SQL Server is a task requiring skills that have been around for forty years coupled with technology that is constantly changing. Pro SQL Server Relational Database Design and Implementation covers everything from design logic that business users will understand, all the way to the physical implementation of design in a SQL Server database. Grounded in best practices and a solid understanding of the underlying theory, Louis Davidson shows how to "get it right" in SQL Server database design and lay a solid groundwork for the future use of valuable business data. The pace of change in relational database management systems has been tremendous these past few years. Whereas in the past it was enough to think about optimizing data residing on spinning hard drives, today one also must consider solid-state storage as well as data that are constantly held in memory and never written to disk at all except as a backup. Furthermore, there is a trend toward hybrid cloud and on-premise database configurations as well a move toward preconfigured appliances. Pro SQL Server Relational Database Design and Implementation guides in the understanding of these massive changes and in their application toward sound database design. Gives a solid foundation in best practices and relational theory Covers the latest implementation features in SQL Server 2016 Helps you master in-memory OLTP and use it effectively Takes you from conceptual design to an effective, physical implementation What You Will Learn Develop conceptual models of client data using interviews and client documentation Recognize and apply common database design patterns Normalize data models to enhance scalability and the long term use of valuable data Translate conceptual models into high–performing SQL Server databases Secure and protect data integrity as part of meeting regulatory requirements Create effective indexing to speed query performance Who This Book Is For Programmers and database administrators of all types who want to use SQL Server to store data. The book is especially useful to those wanting to learn the very latest design features in SQL Server 2016, features that include an improved approach to in-memory OLTP, durability enhancements, temporal data support, and more. Chapters on fundamental concepts, the language of database modeling, SQL implementation, and of course, the normalization process, lay a solid groundwork for readers who are just entering the field of database design. More advanced chapters serve the seasoned veteran by tackling the very latest in physical implementation features that SQL Server has to offer. The book has been carefully revised to cover all the design-related features that are new in SQL Server 2016.
The SQL Server Query Optimizer is perceived by many to be a magic black box, transforming SQL queries into high performance execution plans in the blink of an eye through some unknowable process. The truth is that, while the Query Optimizer is indeed the highly-complex result of decades of research, learning how it works its magic is not only possible, but immensely useful to DBAs and Developers alike. A better understanding of what the Query Optimizer does behind the scenes can help you to improve the performance of your databases and applications, and this book explains the core concepts behind how the SQL Server Query Optimizer works. With this knowledge, you'll be able to write superior queries, provide the Query Optimizer with all the information it needs to produce efficient execution plans, and troubleshoot the cases when the Query Optimizer is not giving you the best plan possible. With over 15 years of experience in the use of Relational Databases (including SQL Server since version 6.5), Benjamin has watched the SQL Server Query Optimizer grow and evolve. His insight will leave you with an excellent foundation in the practicalities of the Query Optimizer, and everything you need to know to start tuning your queries to perfection.
Author: Grant Fritchey
Publisher: Red Gate Books
Release Date: 2012
Every day, out in the various online forums devoted to SQL Server, and on Twitter, the same types of questions come up repeatedly: Why is this query running slowly? Why is SQL Server ignoring my index? Why does this query run quickly sometimes and slowly at others? My response is the same in each case: have you looked at the execution plan? An execution plan describes what's going on behind the scenes when SQL Server executes a query. It shows how the query optimizer joined the data from the various tables defined in the query, which indexes it used, if any, how it performed any aggregations or sorting, and much more. It also estimates the cost of all of these operations, in terms of the relative load placed on the system. Every Database Administrator, developer, report writer, and anyone else who writes T-SQL to access SQL Server data, must understand how to read and interpret execution plans.My book leads you right from the basics of capturing plans, through how to interrupt them in their various forms, graphical or XML, and then how to use the information you find there to diagnose the most common causes of poor query performance, and so optimize your SQL queries, and improve your indexing strategy.
Author: Robert Pearl
Release Date: 2015-06-01
"Robert Pearl, a well-known DBA in the SQL community, explains his holistic vision of a database instance that needs regular check-ups and gives the tools, scripts, and best practices he has collected over the years." Alberto Bolchini, Computing Reviews, May 9, 2016 Healthy SQL is about ensuring the ongoing performance health of a SQL Server database. An unhealthy database is not just an inconvenience; it can bring a business to its knees. And if you are the database administrator, the health of your SQL Server implementation can be a direct reflection on you. It's in everyone's best interest to have a healthy SQL implementation. Healthy SQL is built around the concept of a medical checkup, giving you the tools you need to assess the current health of your database and take action to improve upon that health and maintain good performance to your business. Healthy SQL aids in developing a rigorous routine so that you know how healthy your SQL Server machines are, and how you can keep those same servers healthy and fit for duty. The book is filled with practical advice and a time-tested strategy, helping you put together a regimen that will ensure your servers are healthy, your implementation is fully optimized, your services are redundant and highly available, and you have a plan for business continuity in the event of a disaster. If your current environment doesn't match up with these criteria, then pick up a copy of Healthy SQL today and start your journey on the road to a fit and tight SQL Server deployment.