Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft SQL Server 2012 Performance Tuning Cookbook

You're reading from   Microsoft SQL Server 2012 Performance Tuning Cookbook With this book you'll learn all you need to know about performance monitoring, tuning, and management for SQL Server 2012. Includes a host of recipes and screenshots to help you say goodbye to slow running applications.

Arrow left icon
Product type Paperback
Published in Jul 2012
Publisher Packt
ISBN-13 9781849685740
Length 478 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Toc

Table of Contents (28) Chapters Close

Microsoft SQL Server 2012 Performance Tuning Cookbook
Credits
About the Authors
Acknowledgement
Acknowledgement
About the Reviewers
www.PacktPub.com
1. Preface
1. Mastering SQL Trace Using Profiler FREE CHAPTER 2. Tuning with Database Engine Tuning Advisor 3. System Statistical Functions, Stored Procedures, and the DBCC SQLPERF Command 4. Resource Monitor and Performance Monitor 5. Monitoring with Execution Plans 6. Tuning with Execution Plans 7. Dynamic Management Views and Dynamic Management Functions 8. SQL Server Cache and Stored Procedure Recompilations 9. Implementing Indexes 10. Maintaining Indexes 11. Points to Consider While Writing Queries 12. Statistics in SQL Server 13. Table and Index Partitioning 14. Implementing Physical Database Structure 15. Advanced Query Tuning Hints and Plan Guides 16. Dealing with Locking, Blocking, and Deadlocking 17. Configuring SQL Server for Optimization 18. Policy-based Management 19. Resource Management with Resource Governor Index

Creating and updating statistics


Statistics is an integral part of performance as it helps the SQL Server optimizer choose the proper operation to be performed while executing the SELECT statement. There are two main ways to create and update statistics:

  • Manually create/update statistics

  • Automatically create/update statistics

We will see these options in this recipe.

Getting ready

Before we move further to generate statistics, let us see some commands to view the current settings of statistics for database and table.

The following script will let you know whether the Auto_Create_Statistics option is enabled for databases or not:

SELECT
CASE
WHEN
DATABASEPROPERTYEX('Master','IsAutoCreateStatistics')=1
THEN
'Yes'
ELSE
'No'
END as 'IsAutoCreateStatisticsOn?',
CASE
WHEN
DATABASEPROPERTYEX('Master','IsAutoUpdateStatistics')=1
THEN
'Yes'
ELSE
'No'
END as 'IsAutoUpdateStatisticsOn?',
CASE
WHEN
DATABASEPROPERTYEX('Master','is_auto_update_stats_async_on')=1
THEN
'Yes'
ELSE
'No'
END as 'isAutoUpdateStatsAsyncOn...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image