I am infuriated with the covering up of religious symbols.
This is a part of our heritage, great and small.
It is an absolute insult to all who have immigrated here.
Sin of omission... omit our history of religous heritage...
Respectfully submitted, this is a passive way to say you reject your constituants
Search this insane blog:
Thursday, April 16, 2009
Monday, April 13, 2009
Last time statistics were done?
-- view the date the statistics were last updated:
select 'index Name' = i.[name],-- if you need to update all the indexes:
'Statistics Date' = stats_date(i.[object_id], i.index_id)
from sys.objects o
inner join sys.indexes i
on o.name = 'Employee'
and o.[object_id] = i.[object_id]
update statistics HumanResources.Employee
with fullscan
Wednesday, April 1, 2009
dm_db_index_operational_stats
here's a method I found:
select object_schema_name(ddios.object_id) + '.' + object_name(ddios.object_id) as objectName,
indexes.name, case when is_unique = 1 then 'UNIQUE ' else '' end + indexes.type_desc as index_type,
page_latch_wait_count , page_io_latch_wait_count
from sys.dm_db_index_operational_stats(db_id(),null,null,null) as ddios
join sys.indexes
on indexes.object_id = ddios.object_id
and indexes.index_id = ddios.index_id
order by page_latch_wait_count + page_io_latch_wait_count desc
Find Fragmentation on a specific table
-- How to find fragmentation (yet another way)
declare @MyDatabase sysname,
@MyTable sysname
set @MyDatabase = 'Adventureworks'
set @MyTable = 'HumanREsources.Employee'
select
index_id,
avg_fragmentation_in_percent,
avg_page_space_used_in_percent
from
sys.dm_db_index_physical_stats(db_id(@MyDatabase),
object_id(@MyTable),
null,
null, 'detailed')
where
index_id <> 0
also, find row-level i/o, locking and latching issues and access method activity:
by the way, this is an excerpt from SQL Server Books online
declare @MyDatabase sysname,
@MyTable sysname
set @MyDatabase = 'Adventureworks'
set @MyTable = 'HumanREsources.Employee'
select
index_id,
avg_fragmentation_in_percent,
avg_page_space_used_in_percent
from
sys.dm_db_index_physical_stats(db_id(@MyDatabase),
object_id(@MyTable),
null,
null, 'detailed')
where
index_id <> 0
also, find row-level i/o, locking and latching issues and access method activity:
by the way, this is an excerpt from SQL Server Books online
DECLARE @db_id smallint; DECLARE @object_id int; SET @db_id = DB_ID(N'AdventureWorks'); SET @object_id = OBJECT_ID(N'AdventureWorks.Person.Address'); IF @db_id IS NULL BEGIN; PRINT N'Invalid database'; END; ELSE IF @object_id IS NULL BEGIN; PRINT N'Invalid object'; END; ELSE BEGIN; SELECT * FROM sys.dm_db_index_operational_stats(@db_id, @object_id, NULL, NULL); END; GO
Subscribe to:
Posts (Atom)