Easy Index suggestion

DECLARE @DBID INT SELECT @DBID = DB_ID() SELECT OBJECT_NAME([OBJECT_ID]) ‘TABLE NAME’,INDEX_TYPE_DESC ‘INDEX TYPE’,IND.[NAME],CASE WHEN AVG_FRAGMENTATION_IN_PERCENT <30 THEN ‘To Be Re-Organized’ ELSE ‘To Be Rebuilt’ END ‘ACTION TO BE TAKEN’ ,AVG_FRAGMENTATION_IN_PERCENT ‘% FRAGMENTED’ FROM sys.dm_db_index_physical_stats(@DBID, NULL, NULL, NULL, NULL) JOIN sys.sysindexes IND ON (IND.ID =[OBJECT_ID] AND IND.INDID = INDEX_ID) WHERE AVG_FRAGMENTATION_IN_PERCENT > 0 AND DATABASE_ID = […]

Maxdop query

declare @core_cnt int declare @numa_node int set @core_cnt = ( select a.[cpu_count] from [sys].[dm_os_sys_info] a ) set @numa_node = ( select max(a.[memory_node_id]) + 1   from [sys].[dm_os_memory_clerks] a   where a.[memory_node_id] < 64 ) — IF LESS THAN 5 CORES, THEN DON’T BOTHER — if @core_cnt > 4 begin declare @max_dop int — 75% OF […]