SQL Server tweaks and tools that make a DBA's life easier This article shares some of the tweaks and tools that can make the job of a SQL Server database administrator (DBA) easier. You'll find tips for all of the following:
Contents
- 1 Indexes
- 2 Keyboard shortcuts
- 3 query execution settings
- 4 copy Behavior
- 5 object detail Explorer
- 6 missing Indexes
- 7 Author credits
- 8 related reading
|
IndexesIf you use "bounded ded" columns, you know the frustration associated with figuring out which columns are supported. The following stored procedures can help:
- Sp_helpindex-a system stored procedure that reports information about the indexes on a table or view
- Sp_helpindex2-a rewrite of the sp_helpindex stored procedure, written by Kimberly Tripp
- Dba_indexlookup_sp-a custom, non-system stored procedure, written by Michelle ufford
Take a look at all of these and use the one best meets your needs. Keyboard shortcutsTo choose a keyboard scheme, in SQL Server Management Studio (SSMs), selectTools | OPTIONS... | Environment | keyboard. Keyboard shortcuts The "standard" keyboard scheme has the following shortcuts by default: Alt+F1 sp_helpCtrl+1 sp_whoCtrl+1 sp_lock Here are some suggestions for additional shortcuts: Ctrl+3 Select Top 100 * FromCtrl+4 sp_tables @table_owner = ‘dbo’Ctrl+5 sp_columnsCtrl+6 sp_stored_procedures @sp_owner = ‘dbo’Ctrl+7 sp_spaceusedCtrl+8 sp_helptextCtrl+9 dba_indexLookup_sp or sp_helpindex2 Please note that any changes you make to these settings will not take effect until you open a new query window. Here's an example of how you cocould use these shortcuts:
- Use Ctrl + 4 to find a list of tables.
- Copy one into your query window.
- Highlight the table name (I usually double-click on it) and press Ctrl + 3 to view a sample of that table's data.
You may want to remove or change the schema filters if you use schemas other than DBO. Query execution settingsSMSs offers advanced settings to help prevent unintentional issues in production environments, such as a query that causes locking or blocking. to access these options in SSMs, chooseTools | OPTIONS... | Query execution | SQL Server | advanced. Query execution settings Some suggestions include:
- Change "SET transaction isolation level" to "Read uncommitted. "This will minimize the impact of your ad-hoc queries by allowing dirty reads. while this can be beneficial for production environments, make sure to understand the implications of this setting before implementing.
- Change "Set deadlock_priority" to "low." This will tell SQL Server to select your session as the victim in the event of a deadlock.
- Change "Set lock timeout" to a smaller, defined value, such as 30000 milliseconds (30 seconds ). by default, SQL Server will wait forever for a lock to be released. by specifying a value, SQL Server will abort after the specified timeout period when a lock is encountered.
You can also make these same setting changes in Visual Studio. Copy BehaviorThis tip is not specific to SQL Server; it's useful for any Microsoft product. Holding down "ALT" while you drag your mouse will change your selection behavior to block selection. Block Selection Object detail ExplorerThe one of the great updates available in SQL Server 2008 is the object detail explorer. for example, you can quickly find the table size and row counts of all the tables in a particle database. the object detail Explorer requires SQL 2008 Management studio, but you can connect SQL 2008 SSMs to a 2005 instance. note: if these options are not visible, right-click the column headers and add them to the display. Object detail Explorer Missing IndexesIf you use SSMs 2008 to execute display estimated query plan (CTRL + l), it will show whether you're re missing any indexes. this will even work if you connect SSMs 2008 to SQL 2005. Missing Index Author creditsMichelle ufford This Wiki article was adapted from a blog post by Michelle ufford. Michelle is a SQL developer dBA for godaddy.com, where she works with high-volume, mission-critical databases. she has over a decade of experience in a variety of technical roles and has worked with SQL Server for the last 5 years. she enjoys performance tuning and maintains an active SQL Server blog. Her online presences include:
- Sqlserverpedia profile: sqlfool
- Blog: http://sqlfool.com/
- Twitter: http://twitter.com/sqlfool/
|