DBLab vs CREATE DATABASE ... TEMPLATE
thin clones vs in-server copies
CREATE DATABASE ... TEMPLATE copies a database inside the same PostgreSQL server, built in and free. DBLab makes thin clones of a full database on its own machine.
Where DBLab is ahead of CREATE DATABASE ... TEMPLATE
Each point pairs what our documentation says with what the CREATE DATABASE ... TEMPLATE documentation says. Follow the links and check.
Clones the Postgres you already run
One copy of the data, many clones
Catches a dangerous migration in CI
DBLabDB 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
Short answer
CREATE DATABASE with TEMPLATE copies one database into a new database in the same PostgreSQL server. It is built in, and in PostgreSQL 18 STRATEGY FILE_COPY with file_copy_method = clone lets the kernel share disk blocks on file systems that support it. The docs say it is not yet intended as a general-purpose COPY DATABASE facility: no other session may be connected to the source while it is copied, and the copy lives in the same server. DBLab makes thin clones on its own machine, each an ordinary PostgreSQL server. To copy a database that nobody is connected to, such as a test fixture, the built-in command needs nothing else.
When CREATE DATABASE ... TEMPLATE is the better choice
- Built into every PostgreSQL server: one SQL command, or createdb -T, with no extra software, machine or license.
- You can make your own template databases: mark one with IS_TEMPLATE and any user with the CREATEDB privilege can copy it.
- Objects added to a template are in every copy. The docs give the example of a procedural language installed in template1 being available in every new database.
- In PostgreSQL 18, STRATEGY FILE_COPY with file_copy_method = clone uses copy_file_range() on Linux and FreeBSD or copyfile on macOS, so the kernel can share disk blocks on some file systems.
- The copy is an ordinary database in the server you already run, with no second server to start, connect to or pay for.

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
DBLab and CREATE DATABASE ... TEMPLATE, side by side
| Question | DBLab | CREATE DATABASE ... TEMPLATE |
|---|---|---|
| What it is | Open-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 2 | A built-in SQL command. CREATE DATABASE works by copying an existing database, template1 by default; TEMPLATE name copies another database in the same cluster. The docs say this is "not (yet) intended as a general-purpose 'COPY DATABASE' facility." 12 |
| Which databases it can copy | YesAny 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 2 | PartlyAny database in the same PostgreSQL cluster, on any server where you may create databases. Any user with CREATEDB can copy a database marked as a template; otherwise only superusers and the owner can. Source and copy are in the same cluster. 12 |
| How a copy is made | Copy-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. docs | WAL_LOG, the default, copies block by block and writes each block to WAL. FILE_COPY copies directories at file system level, with a checkpoint before and after. In PostgreSQL 18, file_copy_method = clone makes FILE_COPY use copy_file_range() (Linux, FreeBSD) or copyfile (macOS), letting the kernel share disk blocks on some file systems. 134 |
| Time to get a copy | A 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 2 | The docs give no times. WAL_LOG is described as the most efficient strategy when the template is small. FILE_COPY reduces WAL volume for a large template but forces two checkpoints. Whether clone shares blocks depends on the file system; the docs do not name which ones do. 13 |
| Data in a copy | YesThe whole database as of the chosen snapshot. Physical mode can follow the source continuously; logical mode is refreshed in full, on a schedule. docsdocs 2 | YesThe whole source database. Database-level settings (set with ALTER DATABASE) and database-level GRANT permissions are not copied. Encoding and locale must match the template, except when template0 is used. 12 |
| Masking sensitive data | YesDocumented options: load an anonymized dump, or apply SQL transformations or PostgreSQL Anonymizer before snapshots are taken. You define the rules. docs | Not documentedNot documented in the sources we reviewed. CREATE DATABASE copies the template database as it is. 12 |
| CI and migration testing | YesDB 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. docs | PartlyNo CI feature is documented. A CI job can run CREATE DATABASE ... TEMPLATE or createdb -T, as long as no other session is connected to the template at that moment. 15 |
| API, CLI and agent access | REST 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 3 | SQL: CREATE DATABASE with TEMPLATE, STRATEGY and IS_TEMPLATE. The createdb program connects to the postgres database and issues the same command. 15 |
| Where it runs | YesOn a machine you control, in any cloud or on-premises. DBLab SE installs from the PostgresAI Console or AWS Marketplace. docsdocs 2 | YesInside the PostgreSQL server that holds the source. The new database is in the same cluster, served by the same server; the docs warn that FILE_COPY's checkpoints may have a noticeable negative impact on overall system performance. 12 |
| Open source | YesDBLab Engine is open source under Apache 2.0. docs | YesPart of PostgreSQL, released under the PostgreSQL License, which the project describes as a liberal open-source license similar to BSD or MIT. 6 |
| Documented limits | DBLab 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 2 | No other session may be connected to the template: CREATE DATABASE fails if one is, and new connections to it are blocked until the copy completes. Encoding and locale must match (except for template0). Database-level settings and GRANTs are not copied. file_copy_method = clone needs operating system support. 123 |
| What you pay for | One 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. docs | Free, part of PostgreSQL. Copies use disk in the same server: WAL_LOG writes each block again and to WAL. With FILE_COPY and file_copy_method = clone, the kernel may share blocks on file systems that support it. 136 |
Pricing
| Product | Plan | List price | Notes |
|---|---|---|---|
| DBLab | DBLab Engine | Free | Open source, Apache 2.0; you run it |
| DBLab | DBLab SE | From $62/month | Billed hourly by machine size, plus your own cloud costs; 2,000 GiB limit; single user |
| DBLab | DBLab EE | Custom | Annual contract, from $0.2662 per 100 GiB per hour; unlimited database size, SSO |
| CREATE DATABASE ... TEMPLATE | Open source | Free | Part of PostgreSQL, PostgreSQL License 6 |
List prices on 18 Nov 2026. The billing units differ, so this is not a total-cost comparison. DBLab pricing
Questions
- Can I copy a production database with CREATE DATABASE ... TEMPLATE?
- Only when no other session is connected to it. CREATE DATABASE fails if any other connection exists when it starts, and new connections to the source are blocked during the copy. The docs say this is not yet intended as a general-purpose COPY DATABASE facility. The copy also lives in the same server as the source. 12
- What does file_copy_method = clone do in PostgreSQL 18?
- It changes how CREATE DATABASE ... STRATEGY=FILE_COPY and ALTER DATABASE ... SET TABLESPACE copy files. The default is COPY. CLONE uses copy_file_range() on Linux and FreeBSD or copyfile on macOS, giving the kernel the opportunity to share disk blocks. The setting was added in PostgreSQL 18. 34
- Which file systems support cloning with file_copy_method?
- The PostgreSQL docs do not name any. They say CLONE uses copy_file_range() or copyfile, "giving the kernel the opportunity to share disk blocks or push work down to lower layers on some file systems." Check your file system's own documentation. 3
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.
Sources
- PostgreSQL docs: CREATE DATABASE
- PostgreSQL docs: Template Databases
- PostgreSQL docs: file_copy_method
- PostgreSQL 18 docs: Release 18
- PostgreSQL docs: Creating a Database
- PostgreSQL License
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.
More comparisons
- pg_dump and pg_restorethin clones vs a full copy each time
- ZFS snapshots and clonessame copy-on-write, by hand or managed
- Amazon Aurora cloningclones of any Postgres vs Aurora clusters
- Amazon RDS Blue/Green Deploymentstest clones vs a switchover
- Amazon RDS snapshot restorethin clones vs a new instance each
- Ardentself-hosted thin clones vs a replicated branch service
- Cloud SQL cloningthin clones vs a new Cloud SQL instance
- Databricks Lakebaseclones of any Postgres vs Lakebase branches
- All comparisons