size
In DBeaver, the “table size” numbers you see in the Database Navigator or Properties → Statistics tab are not stored in DBeaver itself — it simply queries PostgreSQL’s system catalogs and size functions in the background, then formats the results for display.
For Aurora PostgreSQL (and normal PostgreSQL), DBeaver typically does something like:
-
When you open the “Tables” list in the Navigator and enable the Size column
- DBeaver runs a query similar to:
Then it usesSELECT relname, pg_total_relation_size(c.oid) AS total_size FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE relkind = 'r' -- ordinary tables AND n.nspname NOT IN ('pg_catalog', 'information_schema');pg_size_pretty()in its UI to format bytes into KB/MB/GB.
- DBeaver runs a query similar to:
-
When you open “Properties → Statistics” for a single table
- DBeaver queries multiple functions:
It may also querySELECT pg_relation_size('schema.table') AS table_bytes, pg_total_relation_size('schema.table') AS total_bytes, pg_indexes_size('schema.table') AS index_bytes;pg_stat_all_tablesfor live row counts and activity statistics.
- DBeaver queries multiple functions:
-
Caching behavior
- The values are fetched live when you open the view, but DBeaver may cache them in memory for the session so it doesn’t repeatedly call
pg_total_relation_size()unless you refresh.
- The values are fetched live when you open the view, but DBeaver may cache them in memory for the session so it doesn’t repeatedly call
-
Partitioned tables
- By default, DBeaver’s size is for the parent table object. For partitions, it lists them separately, because
pg_total_relation_size()doesn’t automatically sum across all partitions unless you explicitly loop through them.
- By default, DBeaver’s size is for the parent table object. For partitions, it lists them separately, because
If you want, I can give you the exact query DBeaver uses for table sizes in Aurora PostgreSQL by checking its source and showing the SQL it fires. That would match what you see in its UI byte-for-byte. Would you like me to do that?
Comments
Post a Comment