Skip to content

SQLpathy

Share…Learn…Grow !!!

  • Mind Maps
  • Security
  • About

Day: August 2, 2018

When was last statistics updated?

On August 2, 2018 By sqlpathyIn Meta-Data, SQL ServerLeave a comment

Here is the handy query that I use to find out last statistics update date for objects. Key to find statistics update date is function STATS_DATE which takes two arguments – object_id (id of table/indexed view) and stats_id (id of statistics object)

SELECT object_name(object_id) table_name
	,name index_name
	,CASE
		WHEN (is_unique | is_unique_constraint) = 1
			THEN 'UNIQUE-' + type_desc
		ELSE 'NON-UNIQUE-' + type_desc
		END type_desc
	,stats_date(object_id, index_id) last_stats_update_date
FROM sys.indexes ind
WHERE EXISTS (
		SELECT 1
		FROM sys.objects
		WHERE type = 'U'
			AND object_id = ind.object_id
		);

Further Reading:
STATS_DATE

Advertisements

Recent Posts

  • Merry Christmas!!!
  • Mind Map: Database Engine
  • Static Data Masking

SQLPathy Efficacy

  • 58,815 people find it helpful!

Enter your email address to follow SQLPathy and receive notifications of new posts by email.

Join 37 other followers

My Communities

Executive Member C# Corner

Calendar

August 2018
M T W T F S S
« Feb   Sep »
 12345
6789101112
13141516171819
20212223242526
2728293031  

SQLPathy@Twitter

  • Merry Christmas!!! sqlpathy.com/2018/12/26/mer… https://t.co/tbFUfJMFHd 1 month ago
  • SQL Server database engine has two core components: Relational Engine and Storage Engine. Mind-Map (visual presenta… twitter.com/i/web/status/1… 2 months ago
Follow @sqlpathy

Blogs I Follow

  • SQL with Manoj
  • sqlsunday.com
  • SQL Studies
  • Databases - Infrastructure - Security
  • Code Wala
  • Paul Hernandez playing with Data
  • SQL Authority with Pinal Dave

Categories

  • DDL inside transaction
  • Documentation
  • Extended Properties
  • Legacy Applications
  • Logon Trigger
  • Meta-Data
  • Mind Map
  • Performance Tuning
  • Replication
    • Transactional Replication
  • SQL Server
  • SQL Server 2012
    • Database Upgrade
  • SQL Server 2014
  • SQL Server 2019
  • SQL Server agent
  • SQL Server Job
  • SQL Server Security
  • T-SQL
    • lock
    • tablockx
  • Transaction
  • Truncate
  • Uncategorized

Top Posts & Pages

  • Performing SUM over a column of datatype TIME
  • How to use insert query to store images
  • List jobs residing on a particular database
Advertisements
Blog at WordPress.com.
SQL with Manoj

SQL Server, SQL Queries, DB concepts, Azure, Tips & Tricks with >500 articles !!!

sqlsunday.com

T-SQL programming, useful tips and tutorials for the MS SQL Server developer.

SQL Studies

 Live, Learn, Share

Databases - Infrastructure - Security

By K. Brian Kelley

Code Wala

Designing and coding

Paul Hernandez playing with Data

Business Intelligence, Data Analysis, Advanced Analytics and more ...

SQL Authority with Pinal Dave

SQL Server Performance Tuning Expert

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy