DatabricksNavneeth Nair, David Young, Murali TalluriAnnouncement
Announcing General Availability of native Lakebase Postgres sink for Spark Structured Streaming
Summary
Databricks announced general availability of a native Lakebase sink for Apache Spark Structured Streaming, a connector that writes computed results directly to Lakebase Postgres, its fully managed serverless PostgreSQL database. The sink handles batching, retries, connection pooling, deduplication, and upserts automatically, and supports declarative merge strategies for non-key columns, eliminating custom foreach writers. It supports both micro-batch and Real-Time Mode, and works with tables registered in Unity Catalog or external PostgreSQL databases via a connection. In a benchmark with 20K events per second and 5 million active users, the sink achieved P50 latency of 183 ms and P99 latency of 354 ms, with Lakebase averaging 0.015 ms per upsert over 63.5 million upserts. The sink is built for low-latency use cases like fraud detection, live personalization, and real-time feature computation, as demonstrated in a video recommendation feature pipeline.
Context
Low-latency use cases such as fraud detection, live personalization, and real-time feature computation require computed results in a serving-ready OLTP store. Lakebase Postgres is Databricks’ fully managed serverless PostgreSQL database, but writing to it from a streaming pipeline previously required building a custom foreach writer with manual batching, retries, and upserts, which is complex and hard to maintain at scale.
Approach / What changed
The native Lakebase sink for Apache Spark Structured Streaming, a connector that writes computed results directly to Lakebase and handles batching, retries, connection pooling, deduplication, upserts, and merge strategies automatically. It supports both micro-batch and Real-Time Mode, and works with tables registered in Unity Catalog or external PostgreSQL databases via a connection.
Takeaways
The native sink eliminates the need for custom foreach writers, handling batching, retries, connection pooling, deduplication, and upserts automatically.
In a benchmark with 20K events per second and 5 million active users, the sink achieved P50 latency of 183 ms and P99 latency of 354 ms.
The sink supports declarative merge strategies for non-key columns, such as keeping the latest non-null value or the value from the newest event, with no hand-written ON CONFLICT SQL.
FAQ
What is the native Lakebase sink for Spark Structured Streaming?
It is a Structured Streaming connector that writes computed results directly to Lakebase. It handles batching, retries, connection pooling, deduplication, upserts, and workspace-managed authentication, so you do not build a custom foreach writer. The same connector works in both micro-batch and Real-Time Mode.
Is the native Lakebase sink generally available?
Yes. The native Lakebase sink for Spark Structured Streaming is now generally available on Databricks Runtime 18 LTS and above. The RealTime and ProcessingTime triggers run on classic compute; on serverless, use Trigger.AvailableNow. It is not supported in Lakeflow Declarative Pipelines.
Does the sink support upserts and custom merge logic?
Yes. Declare an upsertkey and the sink maintains one row per key. Merge strategies (DBR 19+) control how non-key columns update on conflict, such as keeping the latest non-null value or the value from the newest event, with no hand-written ON CONFLICT SQL.
Source and freshness
- Source
- databricks.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.