Key takeaways
- PostgreSQL has no settings page for size: a developer runs pg_database_size, and the total across production databases, in GB, is the number to report.
- The size on disk counts indexes, TOAST data and dead rows, so a pg_dump file is often several times smaller, and console storage figures on Amazon RDS or Cloud SQL include logs and free space.
- pg_dump -Fd -j 4 writes a compressed, parallel dump of one database, best run on a read replica; roles and tablespaces need pg_dumpall --globals-only.
- You don't need to export anything to apply: have your size in GB, years of history and account count ready, and the data vendor anonymizes the records before any AI lab sees them.
01
What is PostgreSQL data, and why do AI labs and data vendors buy it?
The short answer
PostgreSQL data is the set of tables that a company's software keeps in a PostgreSQL database: its customers, orders, tickets, shipments, payments and every change of status between them. AI labs (companies that build and train AI models) and data vendors (companies that anonymize business records and package them for those labs) buy a copy because the tables are linked by keys and timestamps, so one customer's whole history can be followed in order.
What a PostgreSQL database records
PostgreSQL is a free, widely used database system, the software that stores a company's records and answers questions about them. A server running PostgreSQL holds one or more databases, and each database holds tables, which are grids in which every row is one record, such as one order, and every column is one fact about it, such as the date.
Rows in different tables are tied together by keys. An order row carries the number of the customer row it belongs to, which is called a foreign key. For many companies the main PostgreSQL database is the system of record, the place where the business's official version of what happened is kept.
Why linked records teach an AI model something
An AI model learns by studying a very large number of examples and finding the patterns in them, and those examples are called training data. A database is a strong example source because it stores what happened, in what order and with what result, each with an exact timestamp. Public text on the internet rarely contains that kind of record, and it cannot be rebuilt from any other source after the fact.
AI labs now want to train AI agents, software that carries out a job step by step, and an agent learns a job from records of that job being done. A data vendor can turn anonymized order and ticket histories into worked examples, or into a practice copy of a business process in which an agent is scored on each attempt. The full mechanism is in AI training data: why AI companies want your company's data.
How PostgreSQL fits into a dataset
A PostgreSQL database is usually one of several sources in a company's dataset, next to email, documents and tickets. Companies are paid $100K to $2M or more per dataset, according to micro1, the data vendor we typically refer companies to. The price covers the whole dataset, not each source on its own, and what your data is worth explains what moves it.
02
Where does PostgreSQL show how much data you have?
The short answer
PostgreSQL has no settings page for size. Your developer or database administrator (the person who looks after the database) asks it with a short query, SELECT pg_size_pretty(pg_database_size(current_database()));, which any user allowed to connect to the database can run. Add the sizes of your production databases together and report the total in gigabytes (GB).
How to read your database sizes
The steps below are run by a developer or database administrator in psql, PostgreSQL's command-line tool, or in any SQL client. They match the functions described in the PostgreSQL documentation on size functions.
- Connect as a user that has the
CONNECTprivilege on each database, which PostgreSQL grants to everyone by default, or that belongs to thepg_read_all_statsrole. No paid plan and no administrator account is needed. - List every database on the server with its size on disk, leaving out the template databases that PostgreSQL keeps for its own use:
SELECT datname, pg_size_pretty(pg_database_size(datname)) FROM pg_database WHERE datistemplate = false ORDER BY pg_database_size(datname) DESC;
- Inside each database, list the 20 largest tables.
pg_total_relation_sizecounts a table together with its indexes and TOAST data (large values PostgreSQL stores outside the main table), andpg_table_sizeleaves the indexes out:SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) AS total, pg_size_pretty(pg_table_size(relid)) AS without_indexes FROM pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC LIMIT 20; - Count the rows. This statement gives a quick estimate for every table, and it is built from statistics that PostgreSQL maintains:
SELECT relname, n_live_tup FROM pg_stat_user_tables ORDER BY n_live_tup DESC;
For an exact figure on one important table, runSELECT count(*) FROM orders;with that table's name. - Find the oldest record in each core table by looking at its date column, for example
SELECT min(created_at) FROM orders;. - If the database runs on a managed host, compare your total with the console. On Amazon RDS (Amazon's hosted database service), the
FreeStorageSpacemetric, which you find in Amazon's CloudWatch monitoring service, compares the free space left with the disk you provisioned. On Google Cloud SQL, the instance's Overview page charts storage use.
What each size function counts
PostgreSQL offers several size functions, and each one answers a different question about the same data.
| Function | What it counts |
|---|---|
pg_database_size | The disk space of a whole database. This is the figure to report. |
pg_total_relation_size | One table with its indexes and TOAST data. |
pg_table_size | One table without its indexes. |
pg_size_pretty | Not a measure itself: it turns a byte count into readable units, in powers of 1024, so its GB is a gibibyte. |
Why the console figure is not your data size
The storage chart on a managed host measures the whole machine's disk, not your tables. It includes transaction logs (the running record of changes PostgreSQL keeps for recovery) and space that is free but already provisioned. The number to report comes from the SQL functions, and the console serves as a cross-check.
03
What should you know about your PostgreSQL data before you apply?
The short answer
Have three facts ready: the size of your production databases in GB, how many years of records they hold and how many people or accounts the records describe. They go into the data manifest, the written summary of which sources hold your records, how many years each covers and roughly how much. You don't need to run an export to find them.
The size in GB
Add up pg_database_size for every production database and write the total in GB. It measures disk use, so it includes indexes, TOAST data and dead rows (rows that were updated or deleted but that PostgreSQL has not yet cleaned out), and it comes out larger than the raw rows. Count only the primary server, since read replicas and backups are copies, and don't report the storage you provisioned on Amazon RDS or Cloud SQL, because that is the size of the disk you bought.
The years of history
The years of history come from the earliest created_at or similar date column in your core tables. If your tables carry no dates, use the day the database instance was created.
The number of seats
For a database, the seat count is the number of people the records describe: the rows in your users or accounts table, for instance. Database roles, the logins that PostgreSQL itself uses, are not seats.
What you don't need to do first
You don't need to export anything to apply, and you don't need to clean or scrub the database. The data vendor anonymizes the records before anyone else sees them, and nothing moves until a lawyer-reviewed license is signed. The application, the intro call and each later step are laid out in how to sell your company's data.
04
How do you export your full PostgreSQL history?
The short answer
A developer or database administrator runs PostgreSQL's own pg_dump tool against each database, ideally on a read replica, with pg_dump -Fd -j 4 -f /backup/mydb_dir -d mydb. Roles and tablespaces are not part of a database dump and come from pg_dumpall --globals-only. On Google Cloud SQL, gcloud sql export sql writes the dump to a Cloud Storage bucket.
Run the export on a read replica
A read replica is a read-only copy of the database that PostgreSQL keeps up to date by itself. Dumping from a replica means the main database carries no extra reading work while the export runs. On Amazon RDS for PostgreSQL, a replica uses PostgreSQL's native replication, as the RDS guide to read replicas describes.
The steps with pg_dump
The pg_dump reference describes the tool. Each step is run once per database by the person holding the database login.
- Write each database in directory format, which splits the dump into one compressed file per table and runs four jobs in parallel:
pg_dump -Fd -j 4 -f /backup/mydb_dir -d mydb
Only directory format accepts the-jflag. - If one file per database is easier to handle, write custom format instead. Both custom and directory dumps are read back with
pg_restore:pg_dump -Fc -f mydb.dump -d mydb
- Roles and tablespaces are cluster-wide, so
pg_dumpskips them, and this command writes them to a separate file:pg_dumpall --globals-only -f globals.sql
If you would rather have a single plain SQL script covering every database in the cluster,pg_dumpall -f cluster.sqlproduces it. - On Google Cloud SQL, export a SQL dump into a Cloud Storage bucket with the command below. The
--offloadflag makes Cloud SQL run the export on a temporary instance, which lightens the load on yours and costs extra, according to Google's export guide:gcloud sql export sql INSTANCE_NAME gs://BUCKET_NAME/mydb.gz --database=mydb --offload
Which dump format to choose
PostgreSQL can write four formats, and they differ in compression and in whether they run in parallel.
| Format | Flag | Compressed by default | Parallel with -j |
|---|---|---|---|
| Plain SQL script | -Fp | No, unless you add -Z | No |
| Custom | -Fc | Yes, with gzip | No |
| Directory | -Fd | Yes, with gzip | Yes |
| Tar | -Ft | No, not supported | No |
Parallel dumps need a server that supports synchronized snapshots, which means PostgreSQL 9.2 or later on a primary and PostgreSQL 10 or later when you dump from a replica. Each parallel job opens its own connection, so the server's connection limit must be high enough.
What a dump includes and leaves out
pg_dump exports one database at a time, and it makes a consistent copy while the database stays in use, without blocking the people reading or writing. The dump holds live rows and the definitions of the indexes, not the index contents or dead rows, so a dump several times smaller than pg_database_size is normal. Roles and tablespaces belong to the whole server and come only from pg_dumpall. When you dump from a replica, data in unlogged tables (tables that PostgreSQL does not write to its recovery log) is always left out.
Cloud SQL requirements
A Cloud SQL export uses pg_dump and writes to Cloud Storage. Before the export, grant the instance's service account the storage.objectAdmin role on the bucket. Google also advises that a quarter of the database's size should be free space on the instance, so that a large export does not trigger aggressive disk growth.
How long an export takes
No vendor publishes a time, because it depends on the database size, the number of parallel jobs and the load on the server. Parallel jobs finish sooner but add load, so a quiet period or a replica is the safe choice for a large database.
Sources: PostgreSQL documentation, Database object management functions and pg_dump; Amazon RDS user guide, read replicas for RDS for PostgreSQL; Google Cloud, Export and import using SQL dump files. Steps checked against these pages in November 2026.
05
What stays private when PostgreSQL data is licensed?
The short answer
The company decides which schemas and tables leave the database, and the data vendor replaces names and other personal details with consistent stand-ins before an AI lab sees anything. The company keeps ownership of its database, and the license covers defined records for a defined use.
You choose what is in scope
A dump can be limited to the schemas and tables you name, so tables that hold credentials, payment tokens or audit logs can stay out. The option --exclude-table removes a table from the dump, for example pg_dump --exclude-table=payment_tokens -Fd -f /backup/mydb_dir -d mydb. The data vendor also deletes records too sensitive to clean safely instead of anonymizing them.
Names are replaced before a lab sees them
Anonymization means replacing every detail that identifies a person or a company, such as a name or an email address, with a stand-in that is the same every time it appears. The rows still link to each other and the dates still run in order, so a lab can learn from them, but they no longer say who anyone is. The diagram shows one order before and after.
The method, including what is deleted outright and how you review samples, is in how company data is anonymized for AI training.
Ownership and payment
Licensing gives the buyer limited rights to a copy, while the company keeps ownership of the originals. The terms that matter, such as exclusivity, permitted use and deletion, are covered in data licensing. micro1 pays in full within 30 days of accepting the data, usually as a single payment.
Questions
Frequently asked questions
Why is pg_database_size so much bigger than my dump file?
Because the two measure different things. pg_database_size counts disk space, including index contents, TOAST data and dead rows waiting for cleanup, while a dump holds only live rows and index definitions and is compressed in custom and directory formats. It is normal for a dump to be several times smaller than the database.
Will pg_dump slow down or lock our production database?
It does not block anyone who is reading or writing, but it adds reading work for as long as it runs. On a large database, run it against a read replica or at a quiet hour.
Does pg_dump include our database users and passwords?
No. Roles belong to the whole server, and pg_dump only reads one database. If you want the roles and tablespaces too, pg_dumpall --globals-only writes them, but database logins are not part of the records that get licensed.
Can we export from Amazon RDS for PostgreSQL without touching the main database?
Yes. Create a read replica, a read-only copy that PostgreSQL keeps current through replication, and point pg_dump at the replica's address. A parallel dump from a replica needs PostgreSQL 10 or later.
Do we need to export PostgreSQL before we apply?
No. The application takes about two minutes and shares no data. You only need your total size in GB, your years of history and your number of accounts for the intro call, and the size queries above give you the first. The full export is needed later, when the records are transferred after you sign the license.
Can we leave out tables that hold sensitive information?
Yes. The company chooses which schemas and tables are in scope, and pg_dump --exclude-table keeps a table out of the dump entirely.
What is PostgreSQL data worth to AI labs and data vendors?
A database is priced as part of a whole dataset rather than on its own. Companies are paid $100K to $2M or more per dataset, according to micro1, and the price depends on the years of history and how completely the records show each job. What your data is worth explains the factors.
Bottom line
Know what is in PostgreSQL, then see what it is worth
You don't need to export anything to apply. Apply in two minutes, describe your records on the intro call, and micro1, the data vendor we typically refer companies to, prices the whole dataset and sends an offer 1–2 days later.
Not legal, tax or financial advice. Figures come from micro1's published pages and public reporting as of November 2026.