Showing posts from July, 2010
Here is a script to find out the currently executing sql statements, of course you can use the ‘sp_who2’, but I use this one very often select C.client_tcp_port, T. text from sys.dm_exec_conn…
Here is the script to find out the average index fragmentation levels. Based on this value you can either Rebuild or Reorganize the indexes. Index should be rebuild when index fragmentation is great …
SELECT OBJECT_NAME(object_id) AS tblName ,( SELECT name FROM sys.indexes WHERE object_id = a.object_id and index_id = a.index_id) ,avg_fragmentation_in_percent FROM sys.dm_db_index_physical_…
No matter in which order you perform these, here are some points to keep in mind 1) By default, the UPDATE STATISTICS statement uses only a sample of records of the table. Using UPDATE STATISTI…