Files
oracle/star/tabstat.sql

47 lines
1.2 KiB
MySQL
Raw Permalink Normal View History

2026-03-12 21:23:47 +01:00
/* Statistics details for table partitions/subpartitios
Usage: @tabstat <owner> <table>
vplesnila 2024-01-29: creation
*/
col owner for a20 head "Owner"
col table_name for a25 head "Table name"
col last_DML for a20 head "Last DML"
col last_analyzed for a20 head "Last Analyzed"
col STALE_STATS for a7 head "Stale"
col NUM_ROWS head "#Rows"
col INSERTS head "Table|INS"
col UPDATES head "Table|UPD"
col DELETES head "Table|DEL"
col TRUNCATED head "Table|TRUN"
break on report skip 1
compute sum of INSERTS on report
compute sum of UPDATES on report
compute sum of DELETES on report
select
tabstat.OWNER
,tabstat.TABLE_NAME
,tabstat.NUM_ROWS
,tabstat.STALE_STATS
,tabstat.LAST_ANALYZED
,tabmod.INSERTS
,tabmod.UPDATES
,tabmod.DELETES
,tabmod.TRUNCATED
,tabmod.TIMESTAMP last_DML
from
dba_tab_statistics tabstat
,dba_tab_modifications tabmod
WHERE
tabstat.owner = '&&1'
AND tabstat.table_name = '&&2'
AND tabstat.owner = tabmod.table_owner(+)
AND tabstat.table_name = tabmod.table_name(+)
AND tabstat.partition_name = tabmod.partition_name(+)
AND tabstat.subpartition_name = tabmod.subpartition_name(+)
/