2026-03-12 20:23:15
This commit is contained in:
48
vdh/show_tab_stats.sql
Normal file
48
vdh/show_tab_stats.sql
Normal file
@@ -0,0 +1,48 @@
|
||||
set verify off
|
||||
|
||||
set linesize 200
|
||||
set pages 9999
|
||||
|
||||
|
||||
column data_type format a12
|
||||
column num_rows format 999G999G999
|
||||
column num_nulls format 999G999G999
|
||||
column sample_size format 999G999G999
|
||||
column num_distinct format 999G999G999
|
||||
column num_buckets format 999 heading BUC#
|
||||
column density format 0D999999999
|
||||
|
||||
select
|
||||
tab.last_analyzed, tab.num_rows, tab.sample_size, tab.stale_stats
|
||||
from
|
||||
dba_tab_statistics tab
|
||||
where
|
||||
tab.owner = '&&TABLE_OWNER'
|
||||
and tab.table_name = '&&TABLE_NAME'
|
||||
;
|
||||
|
||||
column data_type format a12
|
||||
column num_rows format 999G999G999
|
||||
column num_nulls format 999G999G999
|
||||
column sample_size format 999G999G999
|
||||
column num_distinct format 999G999G999
|
||||
column num_buckets format 999 heading BUC#
|
||||
column density format 0D999999999
|
||||
|
||||
select
|
||||
col.column_name, col.last_analyzed, col.data_type, tab.num_rows, col.num_nulls,
|
||||
col.sample_size, col.num_distinct, col.histogram, num_buckets, col.density
|
||||
from
|
||||
dba_tables tab,
|
||||
dba_tab_columns col
|
||||
where
|
||||
tab.owner = col.owner
|
||||
and tab.table_name = col.table_name
|
||||
and tab.owner = '&&TABLE_OWNER'
|
||||
and tab.table_name = '&&TABLE_NAME'
|
||||
order by
|
||||
col.column_id
|
||||
;
|
||||
|
||||
undefine TABLE_OWNER
|
||||
undefine TABLE_NAME
|
||||
Reference in New Issue
Block a user