- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2016 08:13 PM
Yet another way to get exactly what was originally asked for is to use gs.sql(), if you're on Fuji or older release (it no longer works from Geneva):
gs.sql("SELECT CONCAT('YOUR INSTANCE DATABASE IS CURRENTLY ', ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 1), ' GB') DB_SIZE_GB FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'");
gives (based on table sizes; took 180 ms)
DB_SIZE_GB
YOUR INSTANCE DATABASE IS CURRENTLY 2.8 GB
To get the size per table for all tables, with the largest first, use
gs.sql("SELECT TABLE_NAME, TABLE_ROWS, ROUND(((data_length + index_length) / 1024 / 1024), 2) TABLE_SIZE_MB FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' ORDER BY 3 DESC");
gives (took 308 ms)
TABLE_NAME, TABLE_ROWS, TABLE_SIZE_MB
sys_upgrade_history_log, 340131, 1458.94
sys_attachment_doc, 20109, 220.16
sys_user_token, 149572, 82.78
sys_audit, 55394, 61.13
syslog_transaction0006, 72771, 59.75
syslog_transaction0002, 65791, 56.73
syslog_transaction0003, 68679, 56.73
syslog_transaction0004, 57225, 55.67
sys_metadata, 72777, 53.97
syslog_transaction0005, 58621, 51.81
usageanalytics_count, 35119, 40.75
syslog_transaction0001, 42843, 38.75
syslog_transaction0007, 34261, 31.80
...
To use gs.sql(), you have to elevate privilege to security_admin and use "Scripts - Background" from the Navigator.
WARNING: misuse of gs.sql() may cause unrecoverable damage to your instance.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
