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:

  1. When you open the “Tables” list in the Navigator and enable the Size column

    • DBeaver runs a query similar to:
      SELECT
          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');
      
      Then it uses pg_size_pretty() in its UI to format bytes into KB/MB/GB.
  2. When you open “Properties → Statistics” for a single table

    • DBeaver queries multiple functions:
      SELECT
          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;
      
      It may also query pg_stat_all_tables for live row counts and activity statistics.
  3. 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.
  4. 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.

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

Popular posts from this blog

blocking query