MinervaDB · Databricks Consulting · Delta Lake, Unity Catalog, SQL warehouses, Lakeflow, Mosaic AI
Databricks Consulting: Lakehouse Engineering From the Transaction Log to the Invoice
A Databricks lakehouse is only as fast and as affordable as its file layout, its compute choices and its governance model. MinervaDB Databricks Consulting engineers all three with evidence from the Delta transaction log and the system tables, migrates Hadoop, Teradata and warehouse estates behind reconciled cutovers, and runs the platform 24×7 with a 15-minute Severity-1 response.
Platform architecture
How Databricks consulting lays out the lakehouse
Databricks separates a control plane it operates from the compute that processes your data and the object storage that holds it. Databricks Consulting starts by deciding which workloads run serverless, which run on classic compute in your network, and how every table is registered and governed in Unity Catalog, because those three decisions fix most of the cost and security posture before a line of pipeline code is written.
Figure 1. Control plane, compute planes and the medallion layers in your storage, as assessed in every Databricks consulting engagement.
| Workload | Databricks component | Our default | When we choose otherwise |
|---|---|---|---|
| BI and ad hoc SQL | SQL warehouse | Serverless, Photon, auto-stop in minutes | Sub-second, high-concurrency serving: ClickHouse or a cached serving layer |
| Scheduled ELT | Lakeflow Jobs | Serverless jobs or job clusters under a compute policy | Heavy custom libraries or GPUs: classic job clusters |
| Incremental ingestion | Auto Loader, Lakeflow Connect | Declarative pipelines with expectations | Existing Kafka estates: Structured Streaming jobs |
| Interactive engineering | All-purpose clusters | Small, auto-terminating, policy-bound | Never for scheduled production work |
| ML and GenAI | Mosaic AI, model serving, vector search | Features and models governed in Unity Catalog | Low-volume inference already served elsewhere |
| Data exchange | Delta Sharing | Share governed tables, not extracts | Recipients that only accept files |
Databricks Consulting at MinervaDB is vendor-neutral: when a workload is cheaper or simpler on a warehouse, on PostgreSQL or on ClickHouse, the assessment says so. For warehouse-first estates, compare our Snowflake consulting and BigQuery consulting practices.
Data layout
Liquid clustering instead of partitions and Z-ORDER
Hive-style partitions fix one column at creation time and produce skewed, small-file directories; Z-ORDER rewrites whole partitions on every run. Liquid clustering, generally available on Databricks Runtime 15.4 LTS and above, clusters data incrementally on up to four keys that can change later. Databricks Consulting migrates layouts table by table, measured by pruned files per query before and after.
Figure 3. Partition skew compared with liquid clustering. File counts are illustrative; limits and runtime versions follow the liquid clustering documentation.
In Databricks consulting, choosing keys is an evidence exercise. We take the filter and join columns from system.query.history for the table’s heaviest statements, prefer the columns that appear in most of them, and keep the list short: for tables under about 10 TB, extra keys can weaken single-column filtering. CLUSTER BY AUTO is our default when the workload shifts often.
Deleting old files is the one maintenance step that can break things: shortening VACUUM retention below the time travel window or the longest-running reader removes files still in use. Databricks Consulting runs it only behind a dry run and a confirmation gate, as in the notebook alongside.
Python · Databricks notebook: VACUUM with dry run, confirmation gate and validation
# Databricks notebook (Python): VACUUM behind a confirmation gate
dbutils.widgets.text("table", "")
dbutils.widgets.text("confirm_table", "")
table = dbutils.widgets.get("table")
confirm = dbutils.widgets.get("confirm_table")
# 1. Verify before: retention property and the files a VACUUM would delete
display(spark.sql(f"SHOW TBLPROPERTIES {table} ('delta.deletedFileRetentionDuration')"))
eligible = spark.sql(f"VACUUM {table} RETAIN 168 HOURS DRY RUN").count()
print(f"files eligible for deletion: {eligible}")
# 2. Confirmation gate: the table name must be entered twice
if not table or confirm != table:
raise Exception("Confirmation mismatch. No files deleted.")
# 3. Delete unreferenced files older than 7 days (never shorter than the table's retention)
spark.sql(f"VACUUM {table} RETAIN 168 HOURS")
# 4. Validate after: the dry run is now empty and history records the VACUUM operation
print(spark.sql(f"VACUUM {table} RETAIN 168 HOURS DRY RUN").count())
display(spark.sql(f"DESCRIBE HISTORY {table} LIMIT 5"))
SQL performance
SQL warehouse performance from system.query.history
A slow dashboard is rarely one problem. The query history splits every statement into time queued at capacity, compilation, execution and result fetch, and records bytes read, files pruned, spill and cache use. Databricks Consulting reads those columns first, so a queueing problem gets more clusters and a spill problem gets a larger size, instead of both getting a bigger bill.
Figure 4. One statement’s time split as system.query.history records it; durations are illustrative.
Databricks SQL · system.query.history: slowest statements with their dominant segment
-- SQL warehouse statements from the last 7 days, ranked by elapsed time, split by segment
SELECT compute.warehouse_id,
executed_by,
statement_id,
ROUND(total_duration_ms / 1000, 1) AS total_s,
ROUND(waiting_at_capacity_duration_ms / 1000, 1) AS queued_s,
ROUND(compilation_duration_ms / 1000, 1) AS compile_s,
ROUND(execution_duration_ms / 1000, 1) AS exec_s,
ROUND(read_bytes / POW(1024, 3), 2) AS read_gib,
ROUND(100 * pruned_files / NULLIF(pruned_files + read_files, 0), 1) AS pruned_pct,
ROUND(spilled_local_bytes / POW(1024, 3), 2) AS spilled_gib,
from_result_cache,
LEFT(statement_text, 120) AS statement_head
FROM system.query.history
WHERE start_time >= current_timestamp() - INTERVAL 7 DAYS
AND execution_status = 'FINISHED'
AND compute.warehouse_id IS NOT NULL
ORDER BY total_duration_ms DESC
LIMIT 25;
| Symptom in the history | Cause we look for | Change |
|---|---|---|
High queued_s |
Concurrency above the cluster count | Raise max clusters or split warehouses |
Low pruned_pct |
Filter columns not clustered | Clustering keys, predicate rewrite |
High spilled_gib |
Join or aggregate larger than memory | Larger size, pre-aggregation, better join order |
High compile_s |
Very wide views, deep nesting | Simplify views, materialize hot paths |
| Repeated identical text, no cache hits | Non-deterministic functions or changing literals | Stable query text, materialized views |
Databricks Consulting records each change with the before and after figures from the same query, so every recommendation stays tied to a measured result.
Pipelines
Ingestion and pipelines that fail loudly, not silently
Most lakehouse incidents we are called into are data incidents: a schema that drifted, a late file processed twice, a stream that fell behind for a day. Databricks Consulting builds pipelines with explicit contracts, so a bad batch stops at bronze instead of reaching a board report.
Auto Loader
Databricks Consulting uses incremental file discovery with schema inference and rescued data columns, so unexpected fields are kept, not dropped.
Declarative pipelines
Lakeflow Declarative Pipelines (formerly Delta Live Tables) with expectations that warn, drop or fail on bad rows, per rule.
Change data capture
APPLY CHANGES and MERGE patterns for CDC from Debezium, database connectors or Kafka, with SCD type 1 or type 2 targets.
Streaming
Structured Streaming with checkpoints in managed storage, trigger intervals set from latency targets, and lag alerting.
Orchestration
Lakeflow Jobs with task dependencies, retries, repair runs and notifications, defined as code in Databricks Asset Bundles.
CI/CD
Bundles deployed per environment from Git, with unit tests on transformations and data tests on the output tables.
Streaming sources often start in Kafka; our Kafka consulting team designs the topics and retention that the lakehouse consumes, and our data modernization practice plans the wider estate.
Unity Catalog
Unity Catalog governance enforced in the engine
Governance that lives in a policy document fails the first audit. Databricks Consulting puts it in Unity Catalog: grants on groups, row filters and column masks as SQL functions, lineage captured automatically, and audit logs queryable from the system tables.
Databricks SQL · row filter, column mask and group grants
-- Row filter: regional analysts see their region only; the admin group sees every row
CREATE OR REPLACE FUNCTION main.security.region_filter(region STRING)
RETURN is_account_group_member('data_admins')
OR (is_account_group_member('analysts_emea') AND region = 'EMEA')
OR (is_account_group_member('analysts_apac') AND region = 'APAC');
ALTER TABLE main.sales.customers SET ROW FILTER main.security.region_filter ON (region);
-- Column mask: only the privacy group reads full email addresses
CREATE OR REPLACE FUNCTION main.security.mask_email(email STRING)
RETURN CASE WHEN is_account_group_member('pii_readers') THEN email
ELSE regexp_replace(email, '^[^@]+', '***') END;
ALTER TABLE main.sales.customers ALTER COLUMN email SET MASK main.security.mask_email;
-- Grants go to groups, never to individual users
GRANT USE CATALOG ON CATALOG main TO `analysts_emea`;
GRANT USE SCHEMA ON SCHEMA main.sales TO `analysts_emea`;
GRANT SELECT ON TABLE main.sales.customers TO `analysts_emea`;
| Obligation | Control | Evidence |
|---|---|---|
| Least privilege | Group grants on catalog, schema, table | information_schema privilege views |
| Row and column protection | Row filters, column masks | Policy functions under version control |
| Lineage | Automatic table and column lineage | Lineage system tables for audited reports |
| Network isolation | PrivateLink, IP access lists, no public IPs | Workspace network configuration |
| Encryption | Customer-managed keys for storage and services | Key configuration per workspace |
| Regulation | SOC 2, ISO 27001, HIPAA, GDPR, India’s DPDP Act | Control-to-evidence map per framework |
Enterprise-wide programmes run with our data governance consulting team, and model governance with our MLOps consulting practice.
Test every clustering change, retention change, policy function and pipeline change in a non-production workspace first, keep Delta time travel and cloud storage versioning as recovery paths, and maintain a robust disaster-recovery posture with a tested secondary region.
Migration
Migrating to Databricks without losing a number
In Databricks consulting, a migration is finished when the reports match, not when the tables load. Databricks Consulting runs every migration with parallel operation and automated reconciliation, and decommissions the source only after the business signs off on matching results.
| Source | Path we use | What we reconcile |
|---|---|---|
| Hadoop, Hive, Impala | Table-by-table conversion to Delta, Spark job refactoring, Hive metastore to Unity Catalog | Row counts, partition aggregates, job outputs |
| Teradata, Netezza, Oracle warehouses | Automated SQL conversion, then manual work on procedures and ETL | Report-level results, aggregates per period |
| Snowflake, Redshift, BigQuery | Bulk unload to object storage, SQL dialect conversion, parallel run | Query-level result parity, cost per workload |
| Spark on EMR, Dataproc or HDInsight | Runtime upgrade, cluster policies, Lakeflow Jobs | Job outputs, runtime and cost per run |
| Legacy ETL tools | Rebuild as declarative pipelines or dbt on Databricks SQL | Output tables, row-level diffs on samples |
Related work: Redshift consulting and data analytics and data warehousing support.
Engagement
How Databricks consulting engagements run
Every Databricks consulting engagement starts with measurement: two weeks reading the transaction logs, query history, billing tables and Unity Catalog configuration, ending in a ranked list of findings with the evidence query behind each.
Weeks 1–2
Assess
Layout health, query hotspots, cost attribution, governance gaps and risks.
Design
Architect
Compute strategy, clustering keys, catalog structure, pipeline contracts.
Build
Engineer
Pipelines, migrations and tuning with a verification query after every change.
Run
Operate
24×7 support, monthly cost and performance reviews, quarterly DR tests.
Related services: remote DBA services and 24/7 emergency DBA coverage.
FAQ
Databricks Consulting FAQ
Questions teams ask before starting Databricks consulting with MinervaDB.
Should we move from partitioning and Z-ORDER to liquid clustering?
For most tables, yes. Liquid clustering is generally available on Databricks Runtime 15.4 LTS and above, clusters data incrementally and lets keys change later. We keep partitions only for very large tables where dropping whole date directories is the retention mechanism.
Why are our SQL warehouse queries slow?
We split the time in system.query.history into queueing, compilation, execution and fetch. Queueing needs more clusters, low file pruning needs clustering on the filter columns, and spill needs a larger size or less data per join.
How do you reduce Databricks cost?
Databricks consulting cost work starts by attributing every DBU to an owner from the billing system tables, then moving scheduled work off all-purpose clusters, setting warehouse auto-stop in minutes, enforcing compute policies and fixing layouts that cause full rewrites.
Serverless or classic compute?
Our Databricks consulting default is serverless for SQL warehouses and most jobs, because start-up is fast and idle time is not billed. Classic compute where you need custom images, GPUs, specific networking or libraries serverless does not support.
How do you migrate the Hive metastore to Unity Catalog?
Table by table: external tables are registered in place, managed tables are copied or converted, grants are rebuilt on groups, and jobs are repointed and validated before the old metastore is retired.
Is VACUUM safe to run?
Only with care. It permanently deletes files no longer referenced by the log. We run a dry run first, never go below the table’s retention setting, require a typed confirmation and check the history afterwards.
Do you provide 24×7 support for Databricks?
Yes. Databricks consulting engagements usually continue into 24×7 support with a 15-minute Severity-1 response, monthly reviews and quarterly disaster-recovery tests.
Will you tell us when Databricks is the wrong choice?
Yes. MinervaDB is vendor-neutral and does not resell Databricks. When a warehouse, PostgreSQL or ClickHouse fits a workload better, we say so with a cost and risk comparison.
Put a lakehouse engineering team on your Databricks estate
Start with a two-week assessment of layout, query performance, cost attribution and governance, ranked by impact. Databricks Consulting for active incidents is available through the same page, 24×7.