space_used.tcl revision 2
2N/A#pragma ident "%Z%%M% %I% %E% SMI" 2N/A# Run this TCL script using "testfixture" in order get a report that shows 2N/A# how much disk space is used by a particular data to actually store data 2N/A# versus how much space is unused. 2N/A# Get the name of the database to analyze 2N/A# Output the schema for the generated report 2N/A# This query will be used to find the root page number for every index and 2N/A# table in the database. 2N/A# Initialize variables used for summary statistics. 2N/A# Analyze every table in the database, one at a time. 2N/A puts ",$size,$n_primary,$n_overflow,$unused_primary,$unused_ovfl);" 2N/A# Output summary statistics: 2N/Aputs "-- Total payload size: $total_size" 2N/Aputs "-- Total pages used: $total_primary primary and $total_overflow overflow" 2N/Aputs -
nonewline "-- Total unused bytes on primary pages: $total_unused_primary" 2N/Aputs -
nonewline "-- Total unused bytes on overflow pages: $total_unused_ovfl" 2N/Aputs "-- Total pages on freelist: $n_free"