Cloud Architecture & FinOps

BigQuery & Cloud Run Ingestion Cost Calculator

Compare legacy streaming inserts ($0.05/GB), Storage Write API ($0.025/GB), and GCS batch loading ($0.00/GB). Export Terraform, Python, and SQL scripts.

Ingestion Workload

5,000,000/day

1,389 events/hour, 57.9/sec average.

2 KB

290 GB ingested per month.

2.00 TB

Billed at 143 GB after partition pruning.

$0.025/GB

Exactly-once microbatched appends at half the streaming rate.

DAY partitioning plus CLUSTER BY event_type, user_id prunes ~93% of scanned bytes on time-bounded queries.

Projected Monthly Cost

Ingestion
$7.25

290 GB x $0.025/GB

Active Storage
$17.17

858 GB x $0.02/GB (90d)

Query Scans
$0.035

143 GB x $0.25/TB

Total GCP Cost / Month

$24.45

Legacy JSON streaming would cost $31.70.

−22.9%
You save
$7.25/mo
# Locionic - BigQuery ingestion table
# Generated by the BigQuery & Cloud Run Cost Calculator
# https://locionic.com/ja/blog/bigquery-and-cloud-run-production-data-pipeline
#
# 5,000,000 events/day x 2 KB
# = 290 GB/month via Storage Write API ($0.025/GB)

variable "project_id" {
  type = string
}

resource "google_bigquery_dataset" "events" {
  project_id = var.project_id
  dataset_id = "events_prod"
  location   = "US"
}

resource "google_bigquery_table" "event_stream" {
  project_id = var.project_id
  dataset_id = google_bigquery_dataset.events.dataset_id
  table_id   = "event_stream"

  description = "Raw application event stream (Storage Write API)."

  schema = jsonencode([
    { name = "event_id",   type = "STRING",    mode = "REQUIRED" },
    { name = "user_id",    type = "STRING",    mode = "REQUIRED" },
    { name = "event_type", type = "STRING",    mode = "REQUIRED" },
    { name = "payload",    type = "JSON",      mode = "NULLABLE" },
    { name = "event_time", type = "TIMESTAMP", mode = "REQUIRED" },
  ])

  # DAY partitioning + clustering cuts scanned bytes by ~93% on time-bounded queries.
  time_partitioning {
    type  = "DAY"
    field = "event_time"
    # 90 day TTL | matches the active-storage window in the cost model.
    expiration_ms = 7776000000
  }

  clustering {
    fields = ["event_type", "user_id"]
  }


  labels = {
    ingestion = "swa"
  }
}
Advertisement

よくある質問

How does BigQuery Storage Write API compare to Legacy Streaming Inserts?
The Storage Write API costs $0.025 per GB compared to $0.05 per GB for legacy tabledata.insertAll streaming (a 50% discount). It also provides exactly-once delivery semantics, protocol buffers throughput, and dynamic stream management.
Why is GCS batching considered zero-cost ingestion?
Google Cloud does not charge for BigQuery load jobs from Cloud Storage (GCS). You only pay standard Cloud Storage retention pricing while the Parquet/Avro files sit in the bucket before being loaded or archived.
How much money does table partitioning save on BigQuery queries?
BigQuery on-demand queries charge $6.25 per TB scanned. By partitioning by ingestion date (_PARTITIONDATE or custom TIMESTAMP), queries with date filters prune up to 90-95% of scanned bytes, slashing your query bills proportionally.

The Senior Full-Stack Production Kit (2026)

Checklists, Docker recipes, and SSR error fixes in one dense PDF.

Get Free Kit

関連ディープダイブ

Dev Kits & DataToolsTagsRSSPrivacy PolicyTerms