Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to find tables in the database that do not collect statistics and whose statistics are out of date

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to find out the tables in the database that have not collected statistical information and statistical information is out of date. I hope you will gain something after reading this article. Let's discuss it together.

The following query finds tables that have never collected statistics or whose statistics are out of date.

EXEC DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO

SELECT OWNER,TABLE_NAME,OBJECT_TYPE,STALE_STATS,LAST_ANALYZED FROM

DBA_TAB_STATISTICS WHERE (STALE_STATS='YES' OR LAST_ANALYZED IS NULL)

AND OWNER NOT IN ('SYS',' SYSTEM', 'SYSMAN',' DMSYS', 'OLAPSYS',' XDB','EXFSYS', 'CTXSYS'

'WMSYS', 'DBSNMP',' ORDSYS', 'OUTLN',' TSMSYS', 'MDSYS') AND TABLE_NAME NOT LIKE' BIN%'

Before tuning, we need to see if the statistics of the table are out of date, and if so, CBO may choose the wrong execution plan.

SELECT OWNER,TABLE_NAME,OBJECT_TYPE,STALE_STATS,LAST_ANALYZED FROM DBA_TAB_STATISTICS WHERE OWNER='&OWNER' AND TABLE_NAME='&TABLE_NAME'

After reading this article, I believe you have a certain understanding of "how to find tables in the database that do not collect statistical information and statistical information is out of date". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report