Skip to content

Databases and warehouses

Find and export
your PostgreSQL data.

PostgreSQL can report database and table sizes directly through SQL. These are on-disk measurements, while a logical export contains live records and definitions and can be smaller.

Report in
GB
Category
Databases and warehouses
Last checked

Find your PostgreSQL data size

  1. Connect with a SQL client using an account allowed to inspect the databases in scope.
  2. Run the read-only size query below and record the databases included.
  3. For important tables, use pg_total_relation_size for table-plus-index size and inspect row counts separately.
  4. Use the earliest relevant record timestamp to establish the retained business period.
SELECT datname, pg_database_size(datname) AS size_bytes
FROM pg_database
WHERE NOT datistemplate
ORDER BY size_bytes DESC;
Convert bytes to GB and state the conversion basis. Table statistics can estimate rows; COUNT(*) is an exact query with a potentially larger read cost.

What to include in your data inventory

Report in GB, naming databases, schemas and the measurement basis. Add principal table and record counts where useful.

Describe the oldest retained business dates, external files and backups separately. Identify the application or staff scope represented.

Add the dates covered and the people who use this software. Label estimates and describe how you calculated them.

Export your PostgreSQL history

  1. Have the database administrator plan a consistent export, using a suitable replica where appropriate.
  2. Use pg_dump for each database in a supported custom, directory or SQL format.
  3. Review pg_dumpall --globals-only when roles and other cluster-wide definitions are required.
  4. Collect external files separately and verify the archive against the agreed databases and schema.

pg_dump exports one database; cluster-wide roles and tablespaces use a separate route.

A dump contains live data and index definitions rather than the on-disk index contents and dead rows, so its size can differ from the meter.

Why PostgreSQL data has value for AI training

Application tables can preserve the events and relationships behind a business workflow.

Schema and field descriptions help connect those records to the operations they represent.

What stays private

Select databases, tables and columns in scope, reviewing personal fields and confidential application data.

Telegraph Lab reviews the proposed material with you and agrees how sensitive information will be handled. Preparation can include excluding material, redacting details and replacing personal identifiers. Your company keeps ownership; the licensing agreement defines the material, permitted uses and authorized recipients.

Common questions about PostgreSQL data

Why is the dump smaller than the database?

Storage includes physical structures that a logical dump represents differently, including indexes and unused space.

Does pg_dump collect every database?

It handles one database at a time. Review cluster-wide objects separately.

Are estimated row counts exact?

Statistics are estimates. COUNT(*) produces an exact count for the query's snapshot.

Are files stored outside PostgreSQL included?

Collect external storage separately and preserve its record links.

Your data inventory

Add your numbers to the picture.

Enter the quantities and years covered in your data inventory, then share it with your Telegraph Lab contact. We’ll review the material and discuss the next step with you.

Discuss your data