Skip to content

Dataset

PostgreSQL application database datasets for AI training

A PostgreSQL dataset is a dump of chosen schemas from the database behind a business's own application: its tables with their foreign keys and check constraints, JSONB columns, views, sequences, functions and triggers, and any audit or history tables the application kept. SourceX sources it to a buyer's spec from established businesses that run PostgreSQL in production, as a pg_dump archive or as open-format tables with the catalog definitions beside them. Each dataset is de-identified and licensed for an agreed permitted use.

Dataset manifest

Sourced to your spec
What it is
A pg_dump of chosen schemas: table rows, declared constraints, views, functions, triggers and the application's own audit or history tables
Typical systems
PostgreSQL, self-managed or on a managed service; PostGIS, pgvector and pg_stat_statements where installed
Typical history
Specified by the buyer; current state plus whatever timestamps, soft deletes and audit tables the application wrote
Modality
Structured tables with JSONB and free-text columns, plus SQL and PL/pgSQL definitions
Delivery formats
Agreed per order; pg_dump custom or plain SQL archive, or Parquet or CSV per table with schema DDL and a catalog extract
Preparation
Personal data de-identified with keys kept joinable; password hashes, tokens, session tables and payment fields removed; JSONB and free text scrubbed
Licensing
Rights reviewed per database; permitted use set in the license; customer contracts, hosting terms and extension licenses checked by the buyer and the data owner
Availability
Sourced to your spec from businesses that agree; supply is not guaranteed
Structured recordsIllustrative

What a delivery contains

Fields vary by source system and are fixed per order. A typical delivery includes:

FieldTypeWhat it holds
database_keystringPseudonymous key for the one database the dump was taken from.
schema_namestringThe schema, a namespace in pg_namespace such as public, that holds the table.
table_namestringThe relation's name from pg_class.
columnsarrayColumns from pg_attribute with pg_type names, nullability, identity flags and any enum labels.
primary_keyarrayThe columns of the primary key constraint recorded in pg_constraint.
foreign_keysarrayForeign keys from pg_constraint with referenced table, ON DELETE action and validation state.
check_constraintsarrayCheck constraints from pg_constraint, with the expression as pg_get_constraintdef prints it.
implied_referencesarrayReferences the catalogs do not declare, such as polymorphic type and ID pairs or IDs inside JSONB.
jsonb_profilearrayFor each JSONB column, the keys found, the share of rows carrying each and its value type.
extension_typesarrayColumns whose type belongs to an extension listed in pg_extension, and the open form each was delivered in.
historyobjectHow past state was kept: timestamp columns, a soft-delete column or a trigger-filled audit table.
triggersarrayTriggers from pg_trigger with the pg_proc function each calls and its language.
snapshotobjectThe dump format, the time of the pg_dump snapshot and the rows the dump holds for the table.
query_statsarrayNormalized statements touching the table from pg_stat_statements, with call counts, where it was running.
Sample recordIllustrative

Field names from the table above; values are masked placeholders.

Example record

{
  "database_key": "db_app_main",
  "schema_name": "public",
  "table_name": "orders",
  "columns": [
    {
      "name": "id",
      "type": "bigint",
      "identity": true
    },
    {
      "name": "account_id",
      "type": "bigint"
    },
    {
      "name": "status",
      "type": "order_status",
      "enum_labels": [
        "pending",
        "paid",
        "refunded"
      ]
    },
    {
      "name": "total",
      "type": "numeric(12,2)"
    },
    {
      "name": "metadata",
      "type": "jsonb"
    },
    {
      "name": "ship_to",
      "type": "geometry(Point,4326)"
    },
    {
      "name": "deleted_at",
      "type": "timestamp with time zone"
    }
  ],
  "primary_key": [
    "id"
  ],
  "foreign_keys": [
    {
      "name": "orders_account_id_fkey",
      "columns": [
        "account_id"
      ],
      "references": "public.accounts(id)",
      "on_delete": "RESTRICT",
      "validated": true
    }
  ],
  "check_constraints": [
    {
      "name": "orders_total_check",
      "definition": "CHECK ((total >= (0)::numeric))"
    }
  ],
  "implied_references": [
    {
      "columns": [
        "source_type",
        "source_id"
      ],
      "pattern": "polymorphic",
      "targets": [
        "public.carts",
        "public.subscriptions"
      ]
    },
    {
      "column": "metadata",
      "json_key": "coupon_id",
      "target": "public.coupons"
    }
  ],
  "jsonb_profile": [
    {
      "column": "metadata",
      "keys": [
        {
          "key": "coupon_id",
          "row_share": 0.18,
          "type": "number"
        }
      ]
    }
  ],
  "extension_types": [
    {
      "column": "ship_to",
      "extension": "postgis",
      "delivered_as": "WKT"
    }
  ],
  "history": {
    "mechanism": "audit trigger",
    "audit_table": "audit.order_changes",
    "soft_delete_column": "deleted_at"
  },
  "triggers": [
    {
      "name": "orders_audit",
      "function": "audit.log_change()",
      "language": "plpgsql",
      "events": "INSERT OR UPDATE OR DELETE"
    }
  ],
  "snapshot": {
    "dump_format": "custom",
    "taken_at": "2025-03-02T04:00:11Z",
    "rows_in_dump": 1840233
  },
  "query_stats": [
    {
      "query": "SELECT * FROM orders WHERE account_id = $1 AND status = $2",
      "calls": 912004
    }
  ]
}

Synthetic record for illustration. Field names, structure and format are agreed per order.

What AI teams use it for

Text-to-SQL with a declared join graph

Foreign keys read from the catalogs give exact joins, and JSONB operators, arrays and enum types exercise PostgreSQL's own dialect.

Train backend coding agents

A live application schema with its functions, triggers and migration table is what an agent must read before writing a query or a migration.

Relational models on product data

Customers, orders and events joined by declared keys give multi-table models real distributions, nulls and soft-deleted rows.

Extract structure from JSONB

Documents whose keys changed across releases are realistic practice for schema inference and semi-structured extraction.

Build workload-based evaluations

Normalized statements from pg_stat_statements show what the application really asks, a basis for query-writing and tuning test items.

Use-case guides: Coding agents, Enterprise and computer-use agents, Private evaluation sets

What makes this data valuable

Declared, validated keys

Most references exist as foreign key constraints that were validated, so few joins have to be inferred.

History the application wrote

Audit tables, status-change tables or soft deletes turn a current-state snapshot into sequences of events.

Profiled JSONB

A key-by-key profile of each JSONB column shows what the documents hold before you parse them.

One snapshot per database

A single pg_dump run means every table reflects the same moment.

Extension list supplied

Knowing which extensions and custom types are in use tells you what a restore or conversion needs.

Workload statistics

A pg_stat_statements export shows which tables and query shapes carry the application's traffic.

Process

PostgreSQL dataset

This page covers postgreSQL application databases.Illustrative

What the catalogs declare and what vacuum removes

PostgreSQL keeps its own description of every database in system catalogs that are ordinary tables. pg_class lists the relations, pg_attribute the columns with their types, and pg_constraint the primary keys, the foreign keys with their ON DELETE actions and the check expressions. A dump carries those declarations as DDL, so the join graph of an application can be read and does not have to be guessed from column names, and a check constraint or an enum type states a column's legal values in the database's own words. For text-to-SQL and relational models that is the strength of PostgreSQL data: the keys are facts.

The catalogs hold only what the developers declared. Applications built on an object-relational mapper often leave references undeclared, and two common patterns cannot be declared at all: a polymorphic pair such as commentable_type and commentable_id, which points at a different table row by row, and an identifier kept inside a JSONB document. A JSONB column has one type in the catalog while its keys can drift with each release of the application. A foreign key or check added as NOT VALID was not checked against existing rows, and pg_constraint marks it in its convalidated column until someone validates it. So ask for a key-by-key profile of each JSONB column and a list of the constraints not yet validated.

PostgreSQL does not keep the past. An UPDATE writes a new row version, and the old one survives only until vacuum removes it. No query reads a table as it stood last month, and the hidden xmin column is a transaction ID, not a time. A dump therefore shows current state unless the application recorded history itself, through created_at and updated_at columns, a deleted_at column for soft deletes, status-change tables, or audit tables that a trigger fills with the old and new row. Some businesses stream changes out through logical replication, and then the history lives in the warehouse that received them.

What pg_dump writes and what stays in the cluster

pg_dump exports one database as one consistent snapshot while the application keeps running. It writes a plain SQL script or an archive in custom, directory or tar format, and pg_restore can list an archive's contents or turn it into SQL without a server, so a buyer can inspect a delivery before restoring anything. What pg_dump does not write is whatever belongs to the cluster and not to the database. Roles and tablespaces come only from pg_dumpall, whose output also carries role password hashes that must never be delivered.

Several things are thinner in a dump than in the live database. An extension is recorded as one CREATE EXTENSION statement, so a PostGIS geometry column or a pgvector embedding column restores only where the same extension is installed, and a buyer who wants Parquet needs those columns converted to WKT and plain arrays. Materialized views arrive as definitions to be refreshed, not as stored rows. Large objects can be left out when a dump is limited to chosen schemas or tables. Where row-level security is on, a dump taken by a role the policies restrict either fails or holds only the rows that role could see. pg_stat_statements, with its normalized query text and call counts, is not in a dump at all and has to be exported by query.

To test a sample, restore it into an empty server with no extensions preinstalled and read the errors, since most name a missing dependency. Compare the pg_restore listing with the owner's table inventory, check that pseudonymized keys still join across every declared foreign key, and note which time columns are timestamptz, an absolute instant, and which are timestamp without time zone, whose meaning depends on what the application assumed.

What to check before licensing

  • Ask whose personal data sits in each table, and confirm the business's own customer contracts allow those records to be licensed.
  • Search the sample for password hashes, reset and API tokens, session tables and payment fields, including inside JSONB documents, and confirm no pg_dumpall globals file is delivered.
  • Have the buyer and the data owner check the PostgreSQL license, the terms of any managed service that hosts the database and the licenses of installed extensions for limits on exported data.
  • Request the pg_dump command line and the pg_restore listing, and confirm which schemas, tables and large objects were excluded.
  • Count declared foreign keys against columns that look like references, and ask how polymorphic and JSONB references were identified.
  • Establish how each table records past state, then trace one order or account through its status changes in the sample.
  • List the extensions in pg_extension and restore the sample into a clean server to see which column types fail without them.

Delivery No files move before a signed license. A listing or a request grants no files by itself.

How licensing works through SourceX

  1. 1

    Define

    Send the domain, modality, volume, format, timeline and permitted use you need.

  2. 2

    Source

    SourceX identifies businesses that hold matching data and are open to licensing it.

  3. 3

    Qualify

    Fit, rights and quality are checked, and you review samples before committing.

  4. 4

    License

    Scope, permitted use, exclusivity, price and obligations are agreed in writing.

  5. 5

    Deliver

    Approved data is prepared, de-identified where required and transferred securely.

Questions Acquisition Partners ask

Does a PostgreSQL dump include the history of changes?

No, not by itself. PostgreSQL removes old row versions when vacuum runs, so a dump holds the current state of each table. History is present only where the application wrote it: timestamp columns, soft-delete flags, status-change tables or audit tables filled by triggers. Ask which tables have such a record and how far back it goes.

Do we need to run PostgreSQL to use the data?

No, if you ask for open formats. A custom-format pg_dump archive is restored with pg_restore, which can also write it out as plain SQL, and the same tables can be delivered as Parquet or CSV with the DDL and a catalog extract. Restoring into PostgreSQL keeps constraints, functions and types intact.

What happens to PostGIS, pgvector and other extension columns?

They restore only where the same extension is installed. A dump records an extension as one statement and stores its column values in that extension's own text form. For open formats, geometries are usually converted to WKT or WKB and vectors to arrays. Ask for the extension list, and whether embeddings in the tables came from a third-party model with its own terms.

Are query statistics from pg_stat_statements included?

Only if they are exported separately. The extension keeps normalized statements, with constants replaced by placeholders, and counters for calls and time, but none of that is written by pg_dump. It covers only the period since the statistics were last reset, and only where the extension was enabled.

How are password hashes, tokens and customer data handled?

Personal data is de-identified before delivery, and credential and payment columns should be removed outright, which the buyer confirms on a sample. Application databases hold password hashes, API and reset tokens, session rows and payment references, often duplicated in JSONB columns and audit tables. No method is perfect, so search the sample yourself, JSONB columns included, and check that replaced identifiers still join.

Is SourceX affiliated with the PostgreSQL Global Development Group?

PostgreSQL is named to identify the system the records come from. That does not imply a partnership with or endorsement by the PostgreSQL Global Development Group. The records belong to the business that runs PostgreSQL, which licenses them under a signed agreement, and a request does not guarantee a matching dataset. Buyers should still confirm with counsel that the vendor's terms allow the intended use of exported data.

Evaluating this data for procurement?

Diligence packets are prepared per dataset. Rights, privacy processing and quality differ between datasets.

Request dataset diligence

Tell us what your models need

Send your spec — domain, volume, format, timeline and permitted use — and SourceX will match it against partner data and come back with what can be licensed.

Updated 26 November 2026.

See if your company qualifies