Skip to main content

DBLab vs pg_dump and pg_restore

thin clones vs a full copy each time

pg_dump and pg_restore copy a PostgreSQL database in full and come with PostgreSQL. DBLab loads one copy, for managed services with these tools, then makes thin clones.

See how DBLab worksOpen the demoPricing

Checked on against 6 pages of pg_dump and pg_restore documentation. PostgreSQL only. Markdown

Where DBLab is ahead of pg_dump and pg_restore​

Each point pairs what our documentation says with what the pg_dump and pg_restore documentation says. Follow the links and check.

  1. The whole database, in seconds

    DBLab

    A clone takes a few seconds whatever the database size: under 2 seconds for a 10 TiB database with one user. docsdocs 2

    pg_dump and pg_restore

    pg_dump reads the whole database, and pg_restore loads every row, then creates indexes and constraints; -j runs these steps in parallel. The docs give no times, and each new copy repeats the restore. 126

  2. One copy of the data, many clones

    DBLab

    Clones share one physical copy on one machine and take extra disk space only for what they change. DBLab SE is billed by the size of that machine, not by database size or number of clones. docsdocs 2

    pg_dump and pg_restore

    Each restore creates a full, separate database on the target server; pg_dump dumps index definitions, so indexes are built again. A parallel dump also increases the load on the source server. 261

  3. Catches a dangerous migration in CI

    DBLab

    DB Migration Checker runs pending migrations on a clone in CI and fails those that hold dangerous locks longer than a limit, 10 seconds by default. docs

    pg_dump and pg_restore

    pg_dump and pg_restore are command-line programs, and -w is described as useful in batch jobs and scripts. The sources we reviewed do not describe running migrations on a copy or checking the locks they take. 1

Short answer​

pg_dump exports a consistent snapshot of one PostgreSQL database without blocking readers or writers, and pg_restore loads it into another server, in parallel with the directory or custom format. Each copy is a full, separate database: the restore loads every row and builds every index again. DBLab Engine uses the same dump and restore to load data from managed services such as Amazon RDS, then makes thin clones of that one copy in seconds. For one copy, they need nothing beyond PostgreSQL itself. For many copies of a large database, DBLab restores once instead of once per copy.

When pg_dump and pg_restore is the better choice​

  • Part of PostgreSQL and free under the PostgreSQL License. There is nothing extra to install, run or pay for.
  • Works against any server pg_dump can connect to, back to PostgreSQL 9.2, and the output loads into newer major versions. The docs call it the only method that moves a database to a different machine architecture.
  • Selective copies: -n and -t pick schemas or tables, --exclude-table-data keeps a table's definition without its rows, and pg_restore can restore chosen items from an archive.
  • Parallel dump (-j with the directory format) and parallel restore (-j with custom or directory archives) shorten the copy on a multi-core server.
  • The result is an independent database with its own storage, on any server. DBLab notes that timings on its copy-on-write clones should not be compared directly with production.
The DBLab UI showing a clone that is ready to accept Postgres connections, created in 1.67 seconds, with its psql connection string.

What you get​

A clone in the DBLab UI, ready for connections 1.67 seconds after it was requested (a 2.7 GiB demo database). How it works

See how DBLab worksOpen the demoPricing

DBLab and pg_dump and pg_restore, side by side​

QuestionDBLabpg_dump and pg_restore
What it isOpen-source software that gives every developer, CI job and AI agent a writable, full-size copy of a PostgreSQL database in seconds. Thin clones share one physical copy of the data on one machine. docsdocs 2Two client programs that ship with PostgreSQL. pg_dump exports one database to a SQL script or an archive; pg_restore loads an archive into a database. Used for logical backups and to copy a database from one server to another. 123
Which databases it can copyYesAny PostgreSQL from version 10 up, wherever it runs. Managed services such as Amazon RDS, Aurora, Cloud SQL and Supabase are copied with dump and restore; self-managed servers can also be copied physically with WAL-G, pgBackRest or pg_basebackup. docsdocs 2YesAny PostgreSQL server pg_dump can connect to, back to version 9.2. pg_dump refuses to dump a server newer than its own major version. A dump can be piped straight from one server into another. 13
How a copy is madeCopy-on-write in the file system, with ZFS or LVM. Clones share unchanged blocks, so a clone takes extra disk space only for what it changes. docsA logical copy. pg_dump reads the database in one consistent snapshot and writes SQL commands or archive entries. pg_restore creates the tables, loads the rows, then builds indexes and constraints; indexes are dumped as commands, not contents. 126
Time to get a copyA few seconds whatever the database size: under 2 seconds for a 10 TiB database with one user, up to 30 seconds with 15 users at once. The first copy of the source is slow; about 1 TiB an hour is a good speed. docsdocs 2The docs give no times. By default a dump reads and a restore writes the whole database. pg_dump -j dumps several tables at once (directory format only); pg_restore -j loads data and creates indexes and constraints in parallel. 123
Data in a copyYesThe whole database as of the chosen snapshot. Physical mode can follow the source continuously; logical mode is refreshed in full, on a schedule. docsdocs 2YesThe whole database by default, as of the moment pg_dump started. Optimizer statistics are left out unless pg_dump --statistics is used, an option added in PostgreSQL 18; the docs still suggest ANALYZE after a restore. 134
Masking sensitive dataYesDocumented options: load an anonymized dump, or apply SQL transformations or PostgreSQL Anonymizer before snapshots are taken. You define the rules. docsNot documentedNot documented in the sources we reviewed. --exclude-table-data dumps a table's definition without its rows, and schemas or tables can be left out, but the docs do not describe masking values. 1
CI and migration testingYesDB Migration Checker runs pending migrations on a clone in CI, fails those that hold dangerous locks longer than a limit (10 seconds by default) and collects statistics. Any CI job can also create clones through the API or CLI. docsPartlyNo CI feature is documented. Both are command-line programs, and -w (--no-password) is described as useful in batch jobs and scripts. Each copy made in CI is a full restore. 12
API, CLI and agent accessREST API, web UI and the dblab CLI. Joe, also available as pgai joe, returns EXPLAIN plans and timings from a clone, not rows. docsdocs 2docs 3Command line only. pg_dump writes plain SQL or custom, directory or tar archives; plain SQL is loaded with psql, archives with pg_restore. 13
Where it runsYesOn a machine you control, in any cloud or on-premises. DBLab SE installs from the PostgresAI Console or AWS Marketplace. docsdocs 2YesRuns wherever you run the PostgreSQL client programs. pg_dump connects over the network, so the source and the target can be on different machines. 13
Open sourceYesDBLab Engine is open source under Apache 2.0. docsYesPart of PostgreSQL, released under the PostgreSQL License, which the project describes as a liberal open-source license similar to BSD or MIT. 5
Documented limitsDBLab SE: 2,000 GiB per instance and a single user. All clones share one machine, and copy-on-write storage has different I/O performance, so timings on a clone should not be compared directly with production. docsdocs 2pg_dump copies one database, not roles or tablespaces (pg_dumpall does). It cannot dump a newer major version. A parallel dump needs the directory format and aborts if another session requests an exclusive lock meanwhile. pg_restore -j cannot be combined with --single-transaction. 123
What you pay forOne machine and one physical copy of the data, however many clones run. DBLab SE is billed hourly by the size of that machine, not by database size or number of clones. docsFree software. You pay for the target server and its disk: every copy is a full, separate database, and a new copy repeats the dump or the restore. A parallel dump also increases the load on the source server. 125

Pricing​

ProductPlanList priceNotes
DBLabDBLab EngineFreeOpen source, Apache 2.0; you run it
DBLabDBLab SEFrom $62/monthBilled hourly by machine size, plus your own cloud costs; 2,000 GiB limit; single user
DBLabDBLab EECustomAnnual contract, from $0.2662 per 100 GiB per hour; unlimited database size, SSO
pg_dump and pg_restoreOpen sourceFreePart of PostgreSQL, PostgreSQL License 5

List prices on 18 Nov 2026. The billing units differ, so this is not a total-cost comparison. DBLab pricing

Using DBLab with pg_dump and pg_restore​

DBLab logical mode, the only mode for managed services such as Amazon RDS, Aurora, Cloud SQL and Supabase, copies the source with dump and restore, then makes thin clones of that copy. pg_dump and pg_restore make the one full copy; DBLab serves it to many developers, CI jobs and agents. A full refresh repeats the dump and restore.

Questions​

Is pg_dump enough to make a test copy of a production database?
For a single copy, yes. pg_dump takes a consistent snapshot without blocking readers or writers, and pg_restore loads it into another server. Each copy is full size and needs a full restore, including index builds. When many people or CI jobs need copies of the same large database, DBLab restores once and gives each a thin clone. 123
Does pg_dump copy optimizer statistics?
Not by default. PostgreSQL 18 added pg_dump --statistics, which dumps most optimizer statistics, and pg_restore restores them when the archive has them. Statistics created with CREATE STATISTICS or by extensions are not included, so the docs still suggest running ANALYZE after a restore. 124
Can pg_dump and pg_restore run in parallel?
Yes. pg_dump -j dumps several tables at once, with the directory format only, and needs synchronized snapshots (PostgreSQL 9.2 for primaries, 10 for standbys). pg_restore -j loads data and creates indexes and constraints in parallel from custom or directory archives. 123
Does DBLab use pg_dump?
Yes, for managed services such as Amazon RDS, Aurora, Cloud SQL and Supabase. DBLab logical mode copies the source once with dump and restore, then makes thin clones of that copy; a full refresh repeats it. Self-managed sources can instead be copied physically with WAL-G, pgBackRest or pg_basebackup. 12
Is pg_dump free?
Yes. pg_dump and pg_restore are part of PostgreSQL, released under the PostgreSQL License. The cost is the target server's disk and the time to load and index a full copy each time. 52

Try a clone before you install anything​

The public demo runs DBLab Engine: open it with the token demo-token, create a clone and connect to it. DBLab Engine is open source, so the next step is a machine of your own.

See how DBLab worksOpen the demoPricing

Sources​

  1. PostgreSQL docs: pg_dump
  2. PostgreSQL docs: pg_restore
  3. PostgreSQL docs: SQL Dump
  4. PostgreSQL 18 docs: Release 18
  5. PostgreSQL License
  6. PostgreSQL docs: File System Level Backup

These pages compare what each product does for PostgreSQL; other databases and the rest of the stack are out of scope. What we say about the other product comes from its own documentation, pricing page, changelog or source repository, read on the date shown; each row cites its source. "Not documented" means we did not find it in those sources, not that the product cannot do it. Prices are list prices and the billing units differ, so they are not a total-cost comparison. Product names are trademarks of their owners. Found a mistake? Tell us and we will correct the page.