Search code examples
oracleoracle12cdatabase-performancesql-tuning

How to know the statistics are up to date in Oracle Database?


How to know the statistics are up to date, is there any way to find when the last statistics were calculated?

Do I need to just look at the stale_stats and last_analyzed column of the dba_tab_statistics view?


Solution

  • You can find this in the XXX_TABLES views (e.g. DBA_TABLES, USER_TABLES, ALL_TABLES). The column you're looking for is LAST_ANALYZED, so for example

    SELECT OWNER, TABLE_NAME, LAST_ANALYZED
      FROM USER_TABLES
    

    dbfiddle here