# How We Refresh Razorpay's Data Warehouse 10x Faster with Graphs and Indexes

DevFeed: [How We Refresh Razorpay's Data Warehouse 10x Faster with Graphs and Indexes](<https://devfeed.tech/articles/how-we-refresh-razorpay-s-data-warehouse-10x-faster-with-graphs-and-indexes-24040.md>)

Original publisher: [Read original article](<https://engineering.razorpay.com/how-we-refresh-razorpays-data-warehouse-10x-faster-with-graphs-and-indexes-538abc244703?source=rss----6407ad2e59af---4>)

Author: Amit Prabhu

Published: 2026-07-14T14:06:16Z

Content type: article

Language: en

Sources: [Razorpay](<https://devfeed.tech/sources/razorpay-engineering-medium.md>)

Topics: [Analytics Pipeline](<https://devfeed.tech/topics/analytics-pipeline.md>), [Data pipelines](<https://devfeed.tech/topics/data-pipelines.md>), [data lake](<https://devfeed.tech/topics/data-lake.md>), [deltalake](<https://devfeed.tech/topics/deltalake.md>), [Apache Kafka](<https://devfeed.tech/topics/apache-kafka.md>), [Microservices](<https://devfeed.tech/topics/microservices.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [Data Quality](<https://devfeed.tech/topics/data-quality.md>), [sharding](<https://devfeed.tech/topics/sharding.md>), [parquet](<https://devfeed.tech/topics/parquet.md>)

Tags: [airflow](<https://devfeed.tech/tags/airflow.md>), [analytics](<https://devfeed.tech/tags/analytics.md>), [apache](<https://devfeed.tech/tags/apache.md>), [apache-iceberg](<https://devfeed.tech/tags/apache-iceberg.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [batch](<https://devfeed.tech/tags/batch.md>), [card](<https://devfeed.tech/tags/card.md>), [cardinality](<https://devfeed.tech/tags/cardinality.md>), [cdc](<https://devfeed.tech/tags/cdc.md>), [data](<https://devfeed.tech/tags/data.md>), [data-warehouse](<https://devfeed.tech/tags/data-warehouse.md>), [database](<https://devfeed.tech/tags/database.md>), [delta](<https://devfeed.tech/tags/delta.md>), [delta-lake](<https://devfeed.tech/tags/delta-lake.md>), [faster](<https://devfeed.tech/tags/faster.md>), [graphs](<https://devfeed.tech/tags/graphs.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [razorpay](<https://devfeed.tech/tags/razorpay.md>), [refresh](<https://devfeed.tech/tags/refresh.md>), [warehouse](<https://devfeed.tech/tags/warehouse.md>)

## AI overview

Razorpay replaced full refreshes for its five largest warehouse Facts with incremental batch processing, reporting about 90% less compute time and restored historical coverage that let it reduce TiDB retention. The pipeline models each Fact's joins as a dependency graph, reads daily deduplicated changes, and uses per-entity secondary indexes to find relevant S3 partitions and affected rows. Primary-table changes rebuild complete denormalised rows; secondary-table changes are traced back to affected primary keys and merged into only impacted partitions. High-cardinality dimensions can cause costly write amplification, so Razorpay instead supports some joins at query time: Iceberg tables bucketed by merchant_id let Trino prune scans when that key is included in join predicates. Rollout involved record-level reconciliation, shadow reports, and gradual traffic migration with fallback. The approach trades streaming for batch plus incremental work; the excerpt says the prior streaming system became too costly under highly mutable, high-volume joins. Reported gains apply to the five migrated Facts, with broader migration and real-time index work still on the roadmap.

## Source excerpt

Contributors: Utkarsh Koppikar Rohan Background Razorpay provides the payment infrastructure for millions of merchants globally. Behind every payment, settlement, and refund is a microservices architecture where each service owns its own database. While this keeps services independent and scalable, it creates a challenge for stakeholders who need to see across those boundaries. The Data Platform team manages the infrastructure that bridges this gap. Transactional data flows into the lake via CDC pipelines, ingested onto S3 in Delta Lake, Apache Iceberg, or plain Parquet formats. On top of the lake, we build domain-specific warehouse tables -- wide, pre-joined tables that co-locate all the data a consumer needs, queryable via Trino. These power two use cases: Analytics (internal dashboards on Tableau and Superset) and Reporting (merchants and regulated entities who download structured data exports; Razorpay generates nearly a million such reports per month). The warehouse tables that power both use cases are called Facts. A Fact is a flat denormalised table on S3, produced by joining 10 to 30 microservice tables and materialising the result once. A settlement Fact, for example, merges payments, refunds, adjustments, and card details into a single wide row so that a dashboard or report reads from a single table instead of joining across services in real time. It is closer to a domain-specific materialised view than a classical data warehouse fact table. We maintain over 50 such Facts, and approximately 40% of all merchant reports are served directly from them. As data volumes and the number of entities per fact grew, the batch generation pipeline began to show its limits, prompting us to rethink the refresh strategy, the data layout, and how to handle high-cardinality dimensions. The rest of this post covers that journey. The Full Refresh Pipeline: Our Baseline and the Pain The original full-refresh pipeline was straightforward. Schedule: Airflow schedules Spark jobs o