index

Find last statistics updated date detail ?–Maintenance TIP #59

  Problem:- One of the pain point in any SQL engineer  is “Performance”. There are various reasons due to which your SQL Server database is slow. One of the possible reason is your maintenance.   You don’t know when statistics last updated and take further step if those are not updated Solution:- Here we have simple …

3 different way to find row count of a table ? TIP #45

  Problem:- Many times you want to know how many rows exists in the particular tables. So let me share 3 different way to know this thing Solution:- Let me share 3 different options Option 1:- You all aware of this term which is Count function SELECT COUNT(1)  As Rows FROM [Person].[Person] Option 2:- Sp_Space …

How to determine Last statistics update? TIP #13

To determine last statistics update we need to run following command. GoSELECT o.name, i.name AS [Index Name],         STATS_DATE(i.[object_id], i.index_id) AS [Statistics Date],        s.auto_created, s.no_recompute, s.user_createdFROM sys.objects AS o WITH (NOLOCK)INNER JOIN sys.indexes AS i WITH (NOLOCK)ON o.[object_id] = i.[object_id]INNER JOIN sys.stats AS s WITH (NOLOCK)ON i.[object_id] = s.[object_id] AND i.index_id = s.stats_idWHERE o.[type] …