Skip to the page
Tecyfy

Databricks Lakebase: Postgres next to the lakehouse

Lakebase is a managed Postgres database inside Databricks, for the app, agent and feature lookups a Delta table is too slow for. How it differs from the lakehouse, what it costs per CU-hour, why the default scale-to-zero timeout saves little for an office-hours app, and how data moves between the two.

Tecyfy · Published · 9 min read

Chalk drawing of a small elephant on a jetty handing one box to a rowing boat, crates floating on a wide lake behind

Databricks Lakebase is a managed Postgres database that lives inside your Databricks workspace. It is for the work a LakehouseLakehouseOne store for all of an organisation's data: cheap files in cloud storage, as in a data lake, with the tables, transactions and fast queries of a data warehouse on top. table does badly: an app or an agent reading and writing one row at a time, many times a second, and expecting an answer in milliseconds.

That is the whole difference from the lakehouse. A Delta table on object storage is built to scan millions of rows for a report. A Postgres table is built to find order 48213 by its index, change its status inside a transaction and commit. Lakebase gives you the second without leaving Databricks, and it moves data between the two for you.

Lakebase vs the lakehouse

Lakehouse (Delta, Iceberg)Lakebase (Postgres)
A typical queryScan and aggregate many rowsRead or write a few rows by key
Who calls itDashboards, pipelines, notebooks, GenieYour app, an agent, a model's feature lookup
Connects withSpark, SQL warehouses, Delta readersAny Postgres driver, psql, an ORM
GovernanceUnity CatalogUnity CatalogDatabricks' governance layer: one place that names every table, file volume, model and function as catalog.schema.object, decides who may use each, and records lineage and access.Postgres roles, and the database can be registered in Unity Catalog
Billed byWarehouse or cluster DBUsCapacity Units an hour, plus storage

You keep both. Analytics stays on Delta, and the app's live data sits in Lakebase. A synced table copies a Unity Catalog table into Postgres for the app to read, and Lakebase Change Data Feed writes every change the app makes back as a Delta table. Both are below.

How it is built, and why that matters for the bill

A classic Postgres server keeps its write-ahead log and its data files on the same machine's disk. Lakebase splits that machine in 2. Compute is a stateless Postgres process. Storage is a separate layer: safekeepers hold the write-ahead log, pageservers serve the data pages, and cloud object storage keeps everything durable.

3 features you will meet in the console come straight from that split:

  • Scale to zero. Compute holds no data, so it can be shut down when idle and started again on the next query in a few hundred milliseconds.
  • Branches. A new branch points at the same pages as its parent and stores only what changes afterwards, so a copy of a 500 GB database appears in seconds.
  • Read replicas. Extra read-only computes read the same storage, with no copy of the data to pay for.

If you have used Neon, this is the same design, and Databricks' docs note that Lakebase is also offered on the Neon.com platform.

What Lakebase costs

You pay for compute and storage separately.

Compute is billed in Capacity Units (CU). 1 CU has 2 GB of RAM. A compute autoscales between a minimum and a maximum you set, up to 64 CU, and the gap between the 2 can be at most 16 CU. Databricks' price data for AWS lists Lakebase at $0.40 a DBU and 0.23 DBU per CU-hour on Premium in US East: $0.092 per CU-hour. Enterprise is $0.111. Other regions cost more, from $0.44 a DBU in Ireland to $0.83 in Brazil, where a CU-hour is $0.191.

Storage is billed per GB-month, in 3 kinds. Databricks prices point-in-time restore history at $0.20 and snapshots at $0.09, and says these are about 42% and 74% cheaper than regular branch storage. By our sum, that puts branch storage near $0.35 per GB-month; check system.billing.list_prices for your own rate.

2 rules move the compute line most:

  1. Scale to zero works only when the maximum is 32 CU or less, and never with high availability. The default timeout is 24 hours; it can be anything from 60 seconds to 7 days.
  2. Always-On pricing applies when you turn scale to zero off. The minimum of your range is billed 25% lower once the compute has run 24 hours without stopping. Databricks stacks a further 50% promotional discount on that until 31 January 2027.

Those 2 rules pull in opposite directions, and the default sits in the worst place for one common app.

The default timeout and an office-hours app

Take an internal tool used on weekdays from 8:00 to 18:00, nobody at night or at weekends. It needs about 2 to 5 CU while people work. Set it to autoscale from 2 to 8 CU and try the 4 timeouts below, or use the widget with your own traffic.

Try itA week of a Lakebase compute
Traffic
2

4 GB of RAM

8

16 GB of RAM

max 8 CUMonTueWedThuFriSatSun

Compute billedWhat the traffic asks forAsleep, nothing billed

About $142 a month of compute (1,546 CU-hours), against $537 for a 8 CU compute left on all month. It sleeps 23% of the week and wakes 1 time; each wake adds a few hundred milliseconds to the first query and clears temporary tables and prepared statements.

Lakebase Premium, AWS US East, list price $0.092 per CU-hour; a month is 730 hours. Compute only: storage, synced table pipelines and read replicas are billed on their own. Traffic is drawn in 15-minute steps.

With the widget's office pattern, at $0.092 per CU-hour, a month comes to:

Scale to zeroCU-hours a monthCompute a month
Off (Always-On rate on the 2 CU minimum)about 1,876about $139
After 24 hours, the defaultabout 1,546about $142
After 30 minutesabout 873about $80
After 5 minutesabout 854about $79

The 24-hour default never fires on a weekday: the compute goes quiet at 18:00 and the next query arrives at 8:00, 14 hours later. It sleeps only from Saturday evening to Monday morning. You lose the Always-On discount and gain almost nothing back, so it costs slightly more than turning scale to zero off. A 30-minute timeout sleeps every night and cuts the bill nearly in half.

Going from 30 minutes to 5 saves only another dollar or so, and each wake clears the session: temporary tables, prepared statements, session settings and the cache go. The first query after a wake also waits a few hundred milliseconds, so your app should retry a connection that fails while the compute starts.

The range matters as much as the timeout. A new project starts at 8 to 16 CU with the 24-hour timeout. The same office tool at those settings uses about 4,519 CU-hours, roughly $416 a month, because the 8 CU minimum is billed all week long. Set the minimum from what the app needs when it is quiet, not from its peak. Databricks' cost guide puts the useful cache at up to 75% of RAM, so size the minimum so the rows the app reads most fit in it.

A customer-facing app that is busy every evening is the other case. Its traffic never stops long enough for any timeout, so turn scale to zero off and take the 25%.

Getting lakehouse data in: synced tables

A synced table takes a Unity Catalog table and keeps a read-only copy of it in Postgres, through a managed Lakeflow pipeline. The app reads the copy with an index; it never writes to it.

There are 3 modes:

  • Snapshot copies the whole table each time. It needs nothing from the source, and Databricks says it can be up to 10 times more efficient than Triggered when more than 10% of the rows change between runs. A nightly refresh of a scores table is the usual fit.
  • Triggered applies only the rows that changed since the last run. Run it from a job that starts when the source table is updated. Databricks warns it gets expensive below 5-minute intervals.
  • Continuous streams changes, at intervals of 15 seconds or more. It has the least lag and the highest cost, since the pipeline runs even when nothing changes.

Triggered and Continuous read the source's change data feed, so turn it on first:

ALTER TABLE main.sales.customer_scores
  SET TBLPROPERTIES (delta.enableChangeDataFeed = true);

3 things trip people up. The sync pipeline runs on serverless compute, billed apart from Lakebase. Each sync can open up to 16 connections to the database, and a small compute has few to spare. And rows whose primary key is null are left out of the copy without an error, so check the key before you sync.

Getting app data out: Lakebase Change Data Feed

The other direction is in Public Preview. Lakebase Change Data Feed reads the Postgres write-ahead log and writes every insert, update and delete as a new row in a Delta table called lb_<table>_history, about every 15 seconds. No Debezium, no Kafka, no Change Data CaptureChange Data CaptureCopying only the rows that were added, changed or deleted in a source database, read from its change log, instead of copying the whole table again. job of your own.

Each table needs its old row values in the log, which Postgres does not record by default:

ALTER TABLE orders REPLICA IDENTITY FULL;

Each history row carries _pg_change_type (insert, delete, update_preimage or update_postimage), _pg_lsn, _pg_xid, _timestamp and _sort_by, a key that orders every change. To rebuild the current state of each order in the lakehouse, keep the newest change per key and drop the deleted ones:

SELECT * EXCEPT (rn)
FROM (
  SELECT *,
         ROW_NUMBER() OVER (PARTITION BY order_id ORDER BY _sort_by DESC) AS rn
  FROM main.app.lb_orders_history
  WHERE _pg_change_type <> 'update_preimage'
)
WHERE rn = 1 AND _pg_change_type <> 'delete';

2 limits to plan for: a schema change on the Postgres table makes the feed re-read and rewrite the whole table, and a row filter or column mask on the history table stops the feed writing to it. Put masks on a view over it.

Branches without the surprise storage bill

A branch is a copy of the database for a developer, a test run or a pull request, made in seconds whatever the size. Changes on a child never reach its parent, and you reset a child from its parent to get fresh data. Moving changes the other way is a migration, as with any Postgres database.

The bill depends on one setting. An expiring branch is billed only for the data that changes on it: change 1 GB on a branch of a 100 GB database and you pay for about 1 GB. A branch set to never expire is billed for its full size, like a separate database. Give every development branch an expiry, and use a 30-minute scale-to-zero timeout on its compute.

Point-in-time restore works the same way. To get back a table dropped at 10:23, you create a new branch at 10:22 and copy the rows out. The restore window runs from 2 to 30 days; a longer window keeps more history, billed at the PITR rate.

Lakebase for agents and features

Agents need somewhere to keep a conversation between turns and what they learned across sessions. Databricks' agent templates store both in Lakebase: short-term Agent MemoryAgent MemoryThe ways an agent keeps what it needs beyond a single context window, such as summaries, notes in files, and saved facts it reads back later. The model itself remembers nothing. as checkpoints per thread, through LangGraph checkpointers or the OpenAI Agents SDK, and long-term memory as rows the agent reads back later. It is plain Postgres, so the same database can hold the app's own tables.

Online feature stores for Model Serving run on Lakebase too, and the lakebase_vector and lakebase_text extensions add vector and keyword search, the job pgvectorpgvectorA PostgreSQL extension that adds vector similarity search. does elsewhere. Scale to zero suits an agent used in office hours; an agent that must answer at once at 3:00 needs the compute kept on.

When Lakebase is the wrong tool

  • Reports and scans. A query that reads a year of orders belongs on a SQL warehouse over Delta. Run it on Lakebase and you pay to hold all that data in Postgres and still wait.
  • A database that must never pause. High availability turns off scale to zero, and so does a maximum above 32 CU. That is the right choice for production, but price it as always on.
  • Writes to synced data. A synced table is read-only in Postgres. If the app changes a value, it belongs in a table the app owns, and Change Data Feed carries it back.

Before you build, set 3 numbers yourself rather than keeping the defaults: the minimum CU from your quiet hours, the scale-to-zero timeout from the longest gap in your traffic, and an expiry on every branch. To compare Lakebase with the rest of your Databricks bill, the Databricks cost calculator prices the clusters and SQL warehouses around it.

Questions

What is Databricks Lakebase?
Lakebase is a fully managed Postgres database inside Databricks. It serves applications and agents that need fast reads and writes of single rows, scales its compute up and down on its own, can suspend when idle, and makes instant copy-on-write branches of a database. Unity Catalog tables can be synced into it, and its own changes can be stored back as Delta tables.
What is the difference between Lakebase and the lakehouse?
The lakehouse keeps data in Delta or Iceberg tables on object storage, built for queries that scan many rows. Lakebase is a Postgres database built for an application's many small reads and writes, a row at a time, with indexes, transactions and Postgres drivers. Most teams use both: analytics in the lakehouse, the app's live data in Lakebase, and synced tables or Lakebase Change Data Feed moving data between them.
How much does Databricks Lakebase cost?
Compute is billed per Capacity Unit hour, where 1 CU has 2 GB of RAM. On AWS US East it is $0.40 a DBU at 0.23 DBU per CU-hour on Premium, $0.092 per CU-hour, and $0.111 on Enterprise; other regions cost up to about twice that. Storage is billed per GB-month: Databricks prices point-in-time restore history at $0.20 and snapshots at $0.09. Synced table pipelines run on serverless compute billed on their own.
Does Lakebase scale to zero?
Yes. A compute whose maximum is 32 CU or less can suspend after an idle timeout of 60 seconds to 7 days, 24 hours by default, and wakes in a few hundred milliseconds on the next query. Temporary tables, prepared statements and caches are cleared on wake. Computes with high availability, or with a maximum above 32 CU, cannot scale to zero.
What is Always-On pricing in Lakebase?
When scale to zero is turned off and the compute has an autoscaling range, the minimum of that range is billed 25% lower after 24 hours of continuous use; use above the minimum is billed at the normal rate. High availability computes and the largest instances qualify on their own. Databricks added a further 50% promotional discount on top until 31 January 2027.