Skip to main content

PostgreSQL to Databricks migration planning

A subscription company wants to combine billing, product usage and support activity in Databricks while keeping its application in PostgreSQL. The migration succeeds when finance can explain each invoice and analysts can refresh customer metrics reliably. Copying every row is necessary for a source-faithful landing table, but it does not prove that the resulting customer revenue model is correct.

This guide uses that illustrative business scenario to show how to organize the work. DataDios helps compare supported source and target representations and investigate workload evidence. Your ingestion pipeline moves the data; business owners approve the meaning of the result.

Accept billing records before customer metrics​

Start with invoice lines, payments and subscription changes. Preserve the original identifiers in a landing layer, then validate curated revenue by customer, currency and accounting period. A line-level invoice key and a customer-month aggregate have different grains and need separate comparisons.

For each wave, record the source extraction boundary, target load identifier, fully qualified target tables, mapping version and excluded scope. A timestamp showing that three tables loaded recently does not establish that their records describe the same business moment. Payments that arrived after the invoice extract must either be included coherently or excluded from both sides of the agreed check.

Choose a pilot containing a refund, a canceled subscription, a late correction to an older invoice and a repeated delivery. These cases test whether the target represents changing business state, rather than merely accepting new inserts. Make the replay expected result explicit: the corrected line appears once, its original business identity remains intact, and the downstream amount changes exactly once.

Resolve five decisions before comparing​

IssueWhy finance or analytics noticesValidation decision
Change boundary and deletesA canceled subscription remains billable, or a late refund is absentAlign the source boundary and target load; include delete and correction examples
Identity and retriesOne invoice line appears twice after a pipeline retryPreserve the original key, test uniqueness/nulls, and check idempotent delivery
Numeric meaningLarge or unusually precise amounts change silentlySpecify precision/scale and reconcile exact totals outside floating-point comparison
Event time versus billing dayA payment moves to the next accounting dayPreserve the instant and define the timezone used to derive the business date
JSONB and curated grainA nested discount is dropped or one customer is counted twiceProject required fields explicitly and validate the aggregation separately

The ingestion tool matters. Databricks currently documents its Lakeflow Connect PostgreSQL connector as Public Preview. That connector maps timestamp-without-time-zone, JSONB and arrays to strings; these are connector choices, not a statement that Databricks cannot represent richer data. Its numeric handling also distinguishes precision above 38 and special values. Record the actual mapping used by your pipeline before choosing comparison expressions. See the PostgreSQL connector reference.

For a Lakeflow pilot, explicitly exercise a numeric value whose declared precision exceeds 38 and a NaN value at precision 38 or below: the documented representations are string and null respectively. A null on the target can therefore reflect ingestion behavior rather than a missing source value. Decide whether that is acceptable for the business field; retain a separate exception indicator when the distinction matters. These cases are documented in the Lakeflow PostgreSQL limitations.

Set up a comparison that answers one question​

Use the detailed PostgreSQL → Databricks validation playbook for connector permissions and SmartDiff configuration, alongside Databricks destination prerequisites. The Databricks principal needs SQL Warehouse access and access to the selected catalog, schema and tables. Validate the intended objects using their complete catalog.schema.table names.

Select the Databricks comparison key manually and independently test it on both sides. DataDios does not discover Databricks primary-key constraints for you. If an invoice line has a composite business identity, preserve that identity in the agreed comparison representation rather than trusting a regenerated target surrogate.

For Data Source Diff, prepare bounded snapshot tables representing the same cutoff. For Query Diff, write paired projections with equivalent predicates and business grain. Connection metadata filters do not impose a row cutoff. Review the Databricks comparison limits: a non-batchable key can lead to whole-table reads, and batch size is not a hard memory ceiling. Keep a manifest of completed partitions so a successful sample is not mistaken for full coverage.

Compare invoice identity, customer, currency, status and normalized scalar fields first. Keep exact decimal acceptance independent of DataDios double-precision comparison. Native exact totals by currency and period, retained with the comparison result, provide a financial check that a rounded match percentage cannot replace.

Investigate a failed wave by cohort​

The following numbers are synthetic teaching examples, not a DataDios benchmark or customer result. Suppose a wave contains 120,000 expected invoice lines. The investigation ledger separates missing keys, unexpected keys and changed matched rows:

Observed cohortFirst hypothesisEvidence and next action
18 source-only linesThe target missed the last ingestion segmentCompare source cutoff with completed target load; rerun the segment if confirmed
7 target-only linesTarget includes later source changesCheck event identity and arrival boundary before labeling duplicates
26 matched lines with amount differencesDiscount projection differsInspect original discount fields and exact native line calculations
11 matched lines with billing-day differencesTimezone conversion changedCompare raw timestamp, offset context and approved business-day expression

Changed-field cohorts can contain the same keys: an invoice line may have both an amount and a date difference. Do not sum these field counts into a distinct-row total or add missing/new counts to an overall Diffs count that already includes them. The example is not a complete result summary.

In Results, open the affected invoice table and use Diff by column to focus on the amount or billing date. Only diffs and inline or side-by-side highlighted values help show whether an entire discount was lost or only its representation changed. Inspect cluster patterns as deterministic hints, not proven causes; use Summary value frequencies to see whether differences concentrate on a particular status or value. Export the available table evidence for the billing owner. Standard comparison clusters retain up to 1,000 examples, so an export of retained detail is not a full exception ledger.

These are investigation cohorts, not an automatic diagnosis. Examine representative keys from each group and then establish how many records share the cause. Do not fix 26 amounts by applying a tolerance until the team understands whether the discount is missing or rounding is intentional. Do not delete seven target rows merely to make the totals equal.

After a correction, repeat the affected scope and its dependent customer-month aggregation. Record the run reference, corrected mapping and remaining exceptions. The shared investigation and performance method explains how to separate collection gaps, representation differences and genuine defects.

Test the analytical benefit fairly​

Measure the actual reason for adopting Databricks: refreshing the accepted customer revenue dataset at the required volume and concurrency. Keep the input population, transformation rules and output acceptance fixed. Record environment size, cache conditions, refresh interval and background workloads for every run.

PostgreSQL Performance Analyzer query metrics require installed and preloaded pg_stat_statements. Collect a baseline before measuring the pilot. Total execution time covers calls between collected counters; sampled DB load is average active sessions, not seconds. The maximum execution-time metric reflects the period since statistics reset and cannot establish the maximum for just this pilot.

On Databricks, enable and grant access to the relevant system tables. Compare execution duration separately from capacity and compute queue waits. Include DBU consumption and its pricing basis, rather than treating a smaller execution-time number as a complete cost result. Pin fixed-window source and target charts to a review dashboard, with source-specific labels. The dashboard does not automatically normalize engines or match equivalent queries; retain your controlled run log for end-to-end latency and repeatability.

Experiment hypothesis: moving the analytical refresh should reduce contention on the operational PostgreSQL workload while meeting the accepted refresh deadline. Rerun the same refresh and application load; compare sampled waits on PostgreSQL and separate Databricks queue time from execution time. Reject a faster refresh if application contention or accepted output quality worsens.

Produce an acceptance report someone can sign​

The billing owner should receive the scope manifest, key checks, missing/unexpected/changed cohorts, exact totals by currency, approved exceptions, corrected-run references and customer-metric checks. The platform owner adds runtime, queueing, compute conditions, access verification and a recovery rehearsal. State whether the wave is accepted, held for correction, or accepted with a named exception and expiry.

An enterprise can assign separate owners to ingestion, finance and analytics while sharing this evidence. A smaller company can begin with one billing period and its highest-value report. Measure investigation hours per accepted wave, recurring reconciliation effort and cost per accepted refresh. Include validation reads and parallel pipelines in that cost. The useful outcome is a trustworthy reporting process with a measurable operating improvement.

Review your PostgreSQL to Databricks plan