# Serverless DuckDB 2

> Run DuckDB 2 with read-only PostgreSQL and MariaDB sources, SQL joins, and DuckLake snapshots in managed R2. DuckDB 1 also available.

Canonical: https://layerbase.com/db/duckdb
Last updated: 2026-10-27

Query local tables, PostgreSQL and MariaDB with DuckDB 2. Save analytical snapshots in DuckLake with managed R2. DuckDB 1 is also available.

## Key facts

| Fact | Value |
| --- | --- |
| Engine | DuckDB |
| Category | Analytics |
| Upstream project | [DuckDB](https://duckdb.org/) |
| Layerbase Cloud | Yes |
| Free tier | Yes |
| Pricing | Free plan ($0/mo, no credit card), then $5 or $15/mo flat, no meters |
| Default version | 2.0 |
| Versions for new databases | 1.5, 2.0 |
| Layerbase Desktop | Yes |
| SpinDB (local CLI) | Yes |
| Best for | Ad-hoc analytics over CSVs and Parquet, columnar OLAP workloads, BI dashboards, and teams who want DuckDB without managing a server. |

## Use cases

- Spin up a hosted warehouse for a side project without provisioning infra
- Drop a CSV, JSON, or Parquet file into the web console and query it as a table in seconds
- Prototype an analytics layer that scales to zero between sessions
- Connect Prisma, Drizzle, DBeaver, or any Postgres tool and browse the full schema
- Query PostgreSQL and MariaDB account sources through a Postgres-compatible endpoint
- Attach a DuckDB client natively over HTTPS with the Quack extension and a token you can rotate

## Cloud features

| Feature | Available |
| --- | --- |
| Always-on option | Yes |
| TLS encryption | Yes |
| HTTP access | No |
| IP allowlisting | Yes |
| Web query console | Yes |
| Sleeps when idle, wakes on connect | Yes |
| Automatic backups | Yes |
| Pooled connections | Yes |
| Direct connections | Yes |
| Serverless HTTP driver | No |

## Common DuckDB questions

### Can I use DuckLake with hosted DuckDB?

Yes. DuckDB 2 supports managed DuckLake 1.1 on Pro and Dedicated: PostgreSQL holds metadata and managed R2 stores Parquet data. Managed lake storage has its own allowance equal to your plan storage (25 GB on Pro, plus 25 GB per pool block); over it the lake turns read-only until Reclaim storage frees space or a pool block raises the allowance. Query PostgreSQL and MariaDB as read-only sources, join them, and explicitly copy results into lake tables. DuckDB 1 remains available for standalone use and supported sources. Layerbase does not back up a lake: its Parquet objects are never copied, and a DuckDB database with retained lake state, even after detach, is not covered by local backups and blocks lifecycle operations. Databases with only read-only sources back up normally. Two Beta options, still a work in progress, are also open to Pro and Dedicated without enrollment: keeping the lake in your own AWS S3 or Cloudflare R2 bucket, and attaching a PostgreSQL database hosted outside Layerbase as a read-only source.

### Can I connect a DuckDB client natively?

Yes, on every plan. The owner of a DuckDB 2 database in a personal account can enable a native connection from Connect. It runs over an HTTPS gateway with the Quack extension and a token: copy the snippet into a compatible DuckDB client. Rotate the token or disable native access at any time; enabling, rotating, and disabling briefly restart the database. If the native extension cannot be installed, the database still starts without native access and ordinary SQL over the Postgres-compatible endpoint keeps working.

### What is DuckDB?

DuckDB is an in-process columnar database built for analytics: fast aggregations and scans over CSV, JSON, and Parquet data, with a SQL dialect close to Postgres. It is the usual pick for ad-hoc analysis, BI dashboards, and OLAP work that does not justify a cluster. Layerbase exposes hosted DuckDB through a PostgreSQL-compatible endpoint with a web SQL console, so psql, Prisma, Drizzle, DBeaver, and other Postgres clients can query it.

### Is DuckDB really free on Layerbase?

Yes. Layerbase Free includes DuckDB with no credit card. Your database hibernates after 15 minutes of inactivity and wakes on the next connection. Upgrade only if you need always-on, larger storage, or paid-tier engines.

### How do I connect to hosted DuckDB?

Layerbase Cloud exposes DuckDB through a PostgreSQL-compatible endpoint. Use psql, any PostgreSQL driver, Prisma, Drizzle, or a BI tool: the connection string in the dashboard works with all of them. Schema introspection works too, so a client can browse your tables and columns. SSL is required (?sslmode=require).

### How do I get data into hosted DuckDB?

Three ways. Drag a CSV, JSON, or Parquet file onto the web query console and it becomes a table. Import an existing .duckdb database file to restore it whole. Or query remote files in place with read_parquet and read_csv_auto over a URL. Standard INSERTs and any PostgreSQL client work too.

### Can I use DuckDB locally instead?

Yes. The Layerbase CLI (npm i -g layerbase, run as lbase) runs any database engine locally, including DuckDB, as native processes with no Docker required. Layerbase Desktop wraps the same engine runtime in a GUI. The same database files are portable across local, desktop, and cloud.

### What happens to my DuckDB database if I stop using it?

Free databases hibernate after 15 minutes of inactivity, or 30 for MySQL and MariaDB (paid: 6 hours), and wake automatically on connect, typically in 1 to 2 seconds for DuckDB. After 14 days idle on the Free tier, the database is archived (its network listener and DNS record are removed); you can restore it from the dashboard. Paid plans never auto-archive.

### Is DuckDB available on the desktop app?

Yes. Layerbase Desktop runs DuckDB locally with the same dashboard, query console, and connection management as the cloud version. Free for personal use.

## Links

- [DuckDB on Layerbase](https://layerbase.com/db/duckdb)
- [Create a DuckDB database](https://layerbase.com/create/duckdb)
- [Connecting to DuckDB](https://layerbase.com/docs/cloud/connecting/duckdb)
- [Pricing](https://layerbase.com/pricing) (markdown: https://layerbase.com/pricing.md)
