tailieunhanh - SQL Server MVP Deep Dives- P12

SQL Server MVP Deep Dives- P12: Each year Microsoft invites all the MVPs from every technology and country to Redmond for an MVP Summit—all top secret—“don’t tweet what you see!” During the MVP Summit, each product team holds a series of presentations where they explain their technologies, share their vision, and listen to some honest feedback. | 396 Chapter 29 My favorite DMVs and why SELECT These procedures have not been executed in the past RTRIM uptime minutes the last time SQL started sqlserver_start_time FROM SELECT name p. object_id DB_ID FROM AS p LEFT OUTER JOIN AS ps ON p. object_id ps. object_id WHERE ps. object_id IS NULL ORDER BY p. Name END GO EXEC N GO USE your_database GO EXEC GO WARNING Although creating objects in the master database has been a relatively safe and well-known method for years please proceed with the understanding that you may need to change it later. It is not documented not supported and likely to cease working in some future version of SQL Server. The main problem with using undocumented methods is that Microsoft does not need to warn you before they change or remove the functionality therefore your next upgrade might end up being a lot more work than you thought. Finding inefficient and unused indexes The following query will help you identify indexes in your database that are not used at all or are used more during maintenance operations than for improving query performance. As with the query to find unused procedures what you do with this information will rely heavily on how long SQL Server has been up and running. If you restarted SQL Server this morning then these statistics may not yet represent an adequate sample of your workload. And as with the unused procedure code you will need to create this object in each relevant database because it returns metadata from the local catalog view sys. indexes. If you want to use the system object technique the changes to the code are similarly simple. This code is shown in listing 7. Please purchase PDF Split-Merge on to remove this watermark. Some interesting applications of my favorite DMVs 397 .