💰 Why Cost Optimization Matters

Data platforms can scale costs linearly — or worse — with data volume and usage. A Spark cluster that costs $500/day at 1 TB can cost $15K/day at 30 TB without proper optimization.

Cost optimization ensures the platform stays sustainable while meeting SLAs. It requires understanding storage layout, compute behavior, query patterns, and operational practices.

💡 Interview Gold

"Cost optimization isn't about being cheap — it's about maximizing business value per dollar. A senior data engineer must balance performance, reliability, and cost at every design decision."

The 4 Cost Pillars

Every data platform cost ultimately falls into one of these four buckets.

🖥️ Compute

Cluster hours, warehouse credits, serverless slots. Usually the largest cost driver — 50-70% of total spend in most orgs.

📦 Storage

Raw + derived + duplicate data. Grows silently. A single table with 3 copies across layers can 3x your storage bill.

🌐 Network / Egress

Cross-region transfers, cloud egress, inter-AZ traffic. Often overlooked until the bill arrives.

⚙️ Operations

Backfills, retries, compaction, maintenance. A full historical backfill can cost more than 6 months of normal processing.

Performance Cost

Performance and cost are not opposites. Most optimizations improve both simultaneously.

Filter Early
Less Data Scanned
Faster Queries
Lower Cost

The pattern repeats: less data moved = less time = less money. Partition pruning, column pruning, filter pushdown — they all reduce both runtime and cost.

🎯 When They Diverge

Sometimes you trade cost for speed (e.g., over-provisioned clusters for SLA). Or trade speed for cost (e.g., spot instances with possible preemption). The interview question is: how do you decide which trade-off to make?

Cloud Billing Models

Know these cold — interviewers test whether you understand what you're actually paying for.

💳 On-Demand

  • Pay per hour/second of compute
  • No commitment, full flexibility
  • Highest per-unit cost
  • Best for unpredictable workloads
  • Examples: EC2 on-demand, Databricks DBUs

📋 Reserved / Committed

  • 1-3 year commitment for discount
  • 30-70% cheaper than on-demand
  • Risk: paying for unused capacity
  • Best for stable baseline workloads
  • Examples: RI, Savings Plans, BigQuery slots

🎰 Spot / Preemptible

  • 60-90% cheaper than on-demand
  • Can be terminated with 2 min notice
  • Great for fault-tolerant batch jobs
  • Not for latency-sensitive workloads
  • Examples: EC2 Spot, GCP Preemptible

📊 Per-Query / Serverless

  • Pay per bytes scanned or per query
  • Zero cost when idle
  • Can spike unpredictably with bad queries
  • Best for sporadic, analytical workloads
  • Examples: BigQuery on-demand, Athena

The FinOps Mindset

FinOps is not a tool — it's a culture shift. Engineers own their costs like they own their uptime.

👁️ Inform

Make costs visible. Dashboards, tagging, cost-per-pipeline metrics. You can't optimize what you can't see.

🎯 Optimize

Right-size clusters, use spot instances, partition data, prune columns. Continuous small wins compound.

🏗️ Operate

Automated alerts, guardrails, budget thresholds. Embed cost checks into CI/CD and code reviews.

💡 Interview Gold

"I believe every pull request that touches a pipeline should include a cost impact estimate — even a rough one. This normalizes cost thinking across the team."

Quiz: Test Yourself

Q1: What is typically the largest cost driver in a data platform?

Q2: Your Spark batch job can tolerate restarts. Which billing model saves the most?

Q3: Which of these is NOT a valid cost optimization strategy?

Q4: What best describes the FinOps approach?

Q5: How are performance and cost related in data engineering?