About these ads
  • Home
  • About
  • SQLWikis
  • My Other Musings
  • Webcasts and Events
  • Webcast Videos
  • Business Rantings
  • Tools Tips and Tricks

TroubleshootingSQL

~ Explaining the bits and bytes of SQL Server

TroubleshootingSQL

Tag Archives: Missing Indexes

Missing indexes and Create Index command from the procedure cache

March 21, 2012

Recently I was working on a performance issue for SQL Server where I needed to identify the missing indexes on …

Continue reading »

How to find out the missing indexes on a SQL Server 2008 or 2005 instance along with the CREATE INDEX commands

December 30, 2009

I had previously blogged on Missing Indexes and how useful a feature this is for troubleshooting query performance issues. Here is a script for identifying the missing indexes currently on your instance. However, you would definitely need to show prudence in implementing the indexes reported by these DMVs after a due round of testing. You would also need to make sure that nothing else is broken by implementing new indexes.

SELECT
mig.index_group_handle, mid.index_handle,
CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans)) AS improvement_measure,
‘CREATE INDEX missing_index_’ + CONVERT (varchar, mig.index_group_handle) + ‘_’ + CONVERT (varchar, mid.index_handle)
+ ‘ ON ‘ + mid.statement
+ ‘ (‘ + ISNULL (mid.equality_columns,”)
+ CASE WHEN mid.equality_columns IS NOT NULL AND mid.inequality_columns IS NOT NULL THEN ‘,’ ELSE ” END + ISNULL (mid.inequality_columns, ”)
+ ‘)’
+ ISNULL (‘ INCLUDE (‘ + mid.included_columns + ‘)’, ”) AS create_index_statement,
migs.*, mid.database_id, mid.[object_id]
FROM sys.dm_db_missing_index_groups mig
INNER JOIN sys.dm_db_missing_index_group_stats migs ON migs.group_handle = mig.index_group_handle
INNER JOIN sys.dm_db_missing_index_details mid ON mig.index_handle = mid.index_handle
WHERE CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans)) > 10
ORDER BY migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans) DESC

Continue reading »

Missing Indexes Feature in SQL Server 2005

December 30, 2009

Indexes are essential in making sure that your queries have efficient query plans and for SELECTS, you don’t end up …

Continue reading »

About these ads

Seek Count

  • 305,106 seeks

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 925 other followers

Linked Servers

Facebook Fan Page Twitter RSS Feeds Feedburner Feeds LinkedIn Networked Blogs Google+ Email

Professional SQL Server 2012: Internals and Troubleshooting

Ghosted Posts

TroubleshootingSQL is on Facebook too!

IAM

  • Availability Group (2)
  • Backup (24)
  • Data Recovery (6)
  • Debugging (11)
  • Did you know (22)
  • Excel (1)
  • Memory (9)
  • Microsoft (3)
  • Mirroring (4)
  • Performance (19)
    • Disk (2)
    • Query Tuning (8)
  • Power View (1)
  • Replication (4)
  • Reporting Services (3)
  • Scripts (60)
    • Monitoring (10)
    • Powershell (7)
    • TSQL (36)
    • WMI (11)
  • SQL Agent (1)
  • SQL How To (13)
  • SQL Myths (3)
  • SQL Server (40)
    • Best Practices (16)
  • SQL Server 2012 (12)
  • SQL Setup (11)
  • T-SQL Tuesday (10)
  • Tools (60)
    • Data Analysis (10)
    • Data Collection (20)
    • Monitoring (15)
      • System Health Session (6)
    • Troubleshooting (6)
  • Tools Tips and Tricks (13)
  • Troubleshooting SQL Issues (43)
  • Twost (12)
  • Webcasts and Events (17)
  • Wikis (15)

Spatial Map

Locations of visitors to this page

Creative Commons License
TroubleshootingSQL by Amit Banerjee is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Transaction Log

May 2013
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Blog Roll

  • CSS SQL Server FAQ
  • CSS Escalation Blog
  • Paul Randal's blog
  • Pinal Dave's Blog
  • Balmukund's Blog
  • CSS Replication Blog
  • Jonathan Kehayias' Blog
  • Brent Ozar's Blog
  • Kevin Kline's blog
  • Sudarshan's Blog

Recent Tweets

  • [PSSSQL] Why won't my PowerPivot for Excel 2010 workbook upgrade to Excel 2013? bit.ly/16VyGsN #sql #sqlserver 5 minutes ago
  • Cross-Post: Microsoft announces major expansion of Windows Azure services in Asia: Editor'... bit.ly/14ArcHm #azure #cloud #msft 10 hours ago
  • [BLOG] How to Avoid WinRT Activation Pitfalls:   Summary: If you're trying to get your Windows Store Ap... bit.ly/1a93zGg #mspfe 16 hours ago
  • The TroubleshootingSQL Daily is out! paper.li/TblshootingSQL… ▸ Top stories today via @rusanu @BrentOzarULTD @GFritchey 23 hours ago
  • [SQLServerFAQ] How do I map a differential/transaction log backup to its full backup without u... bit.ly/184t1A0 #sql #sqlserver 1 day ago
Follow @tblshootingsql

TOP (10) ORDER BY Date DESC

  • Twitter Hashtag analysis using Excel 2013
  • SQL Server 2012: Debugging Deadlocked Schedulers
  • Enabling Transactional Replication: A bit of help
  • CScript and RunAsAdmin
  • Differential Base and VSS Backups
  • A year that was
  • SQL Bangalore UG Meet
  • Some facts about the Database Recovery Advisor and Restores
  • Handling Deadlocked Schedulers is a piece of cake now
  • Fluffy in an Availability Group Failover Scenario

Category Azure

#TSQL2sDay Backups Best Practices CHECKDB Cluster Setup Data Analysis Database Files Data Collection Deadlocked Schedulers Debugging Did you know Export Import Wizard Extended Events Maintenance Plans Memory Monitoring Performance Powershell Profiler Trace Query Plan Query Tuning Restore RML Scripts Setup Troubleshooting SQL Memory SQL Nexus SQL Server SQL Server 2005 SQL Server 2008 SQL Server 2012 SQLServerFAQ Stack Dump System Health Session system_health session T-SQL Tools Tools Tips and Tricks Troubleshooting Update Statistics VDI VSS Webcasts and Events WMI XML Plans

Blog at WordPress.com. Theme: Chateau by Ignacio Ricci.

Follow

Get every new post delivered to your Inbox.

Join 925 other followers

Powered by WordPress.com