undefined undefined
{}

Our Brands

Welcome to the Schneider Electric Website

Welcome to our website.
How can we help you today?
How to identify and update outdated Statistics in SQL Server

Issue
A user may be experiencing performance issues when running SQL queries.

Product Line

Power Monitoring Expert 7.2.x

Power Monitoring Expert 8.x

Power Monitoring Expert 9.0

Power Monitoring Expert 2020

Power Monitoring Expert 2021

Power Monitoring Expert 2022

Power Monitoring Expert 2023



Environment
Power Monitoring Expert Software with either SQL Server Versions (2005- 2022)

Cause
Outdated statistics can make the SQL server choose a non-optimal execution plan causing undesirable slow response times for certain queries.

Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing this procedure.*

To identify tables within the database which have outdated statistics, the following query can be used.


SELECT OBJECT_NAME(id) AS Table_Name, st.[name] AS Tname, si.name,
STATS_DATE(id, indid) AS DateLastUpdate,rowmodctr rowsModifiedSinceLastUpdate
FROM sys.sysindexes AS si
INNER JOIN sys.[tables] AS st ON si.[id] = st.[object_id]
INNER JOIN sys.schemas AS ss ON st.[schema_id] = [ss].[schema_id]
WHERE STATS_DATE(id, indid)<=DATEADD(DAY,-1,GETDATE())
AND rowmodctr>10
ORDER BY[rowmodctr] DESC


Once you have identified tables with outdated statistics, the UPDATE STATISTICS  statement can be used to
bring the statistics back up to date.
UPDATE STATISTICS Table_Name

Schneider Electric Ireland

How to identify and update outdated Statistics in SQL Server

Issue
A user may be experiencing performance issues when running SQL queries.

Product Line

Power Monitoring Expert 7.2.x

Power Monitoring Expert 8.x

Power Monitoring Expert 9.0

Power Monitoring Expert 2020

Power Monitoring Expert 2021

Power Monitoring Expert 2022

Power Monitoring Expert 2023



Environment
Power Monitoring Expert Software with either SQL Server Versions (2005- 2022)

Cause
Outdated statistics can make the SQL server choose a non-optimal execution plan causing undesirable slow response times for certain queries.

Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing this procedure.*

To identify tables within the database which have outdated statistics, the following query can be used.


SELECT OBJECT_NAME(id) AS Table_Name, st.[name] AS Tname, si.name,
              STATS_DATE(id, indid) AS DateLastUpdate,rowmodctr rowsModifiedSinceLastUpdate
FROM sys.sysindexes AS si
INNER JOIN sys.[tables] AS st ON si.[id] = st.[object_id]
INNER JOIN sys.schemas AS ss ON st.[schema_id] = [ss].[schema_id]
WHERE STATS_DATE(id, indid)<=DATEADD(DAY,-1,GETDATE())
AND rowmodctr>10
ORDER BY[rowmodctr] DESC


Once you have identified tables with outdated statistics, the UPDATE STATISTICS  statement can be used to
bring the statistics back up to date.
 
UPDATE STATISTICS Table_Name

Schneider Electric Ireland

Explore more
Product:
Explore more
Product:
Users group

Discuss this topic with experts

Visit our Community for first-hand insights from experts and peers on this topic and more.
Users group

Discuss this topic with experts

Visit our Community for first-hand insights from experts and peers on this topic and more.
Explore more
Product:
Explore more
Product:
move-arrow-top
Your browser is out of date and has known security issues.

It also may not display all features of this website or other websites.

Please upgrade your browser to access all of the features of this website.

Latest version for Google Chrome, Mozilla Firefox or Microsoft Edgeis recommended for optimal functionality.
Your browser is out of date and has known security issues.

It also may not display all features of this website or other websites.

Please upgrade your browser to access all of the features of this website.

Latest version for Google Chrome, Mozilla Firefox or Microsoft Edgeis recommended for optimal functionality.