Skip to content

Instantly share code, notes, and snippets.

@RichVRed
Forked from ryanthames/table_info.sql
Created April 28, 2017 23:55
Show Gist options
  • Select an option

  • Save RichVRed/893b124e8e5f4c953d74205c06594c1f to your computer and use it in GitHub Desktop.

Select an option

Save RichVRed/893b124e8e5f4c953d74205c06594c1f to your computer and use it in GitHub Desktop.
-- table info is only as up to date as last time stats were gathered (last_analyzed)
select t.owner, t.table_name, t.num_rows, t.avg_row_len,
t.blocks as blocks_below_hwm, t.empty_blocks,
s.blocks as segment_blocks,
s.bytes / 1048576 as size_in_mb,
to_char(t.last_analyzed, 'YYYY-MM-DD HH24:MI') as last_analyzed
from all_tables t, dba_segments s
where t.owner = s.owner and t.table_name = s.segment_name
and t.owner = 'SCHEMA_NAME';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment