Spotify developed Random Access Parquet (RAP), a storage architecture that enables low-latency point queries directly on data lake storage (Google Cloud Storage) by introducing an external indexing layer. This innovation allows online services and AI applications to access individual records efficiently without costly data replication into operational databases, thereby supporting both analytical and transactional workloads on the same datasets.
Read original on InfoQ ArchitectureModern data lakes, often built on cloud object storage like Google Cloud Storage, excel at analytical processing and machine learning workloads due to their scalability and cost-effectiveness. However, they are fundamentally optimized for large-scale scans rather than individual record lookups (point queries). Traditional distributed query engines like Trino or BigQuery incur significant overhead for key-based lookups, involving query planning, metadata traversal, and extensive file discovery. Replicating petabytes of data from the data lake into operational databases (like Bigtable) for low-latency access is prohibitively expensive and creates data silos.
Spotify's Random Access Parquet (RAP) addresses this by introducing an external indexing layer over immutable Apache Parquet files stored in the data lake. Instead of scanning thousands of files for a specific record, RAP uses this index to map lookup keys (e.g., user IDs) directly to the precise Parquet file and row location. This allows for targeted ranged reads against object storage, drastically reducing the data scanned and improving latency.
Key Innovation
RAP's core innovation is decoupling the index from the data files. This means existing analytical datasets in Parquet and Iceberg formats can be directly used for online serving without modification, eliminating data duplication and synchronization overhead between analytical and operational stores.
RAP also supports secondary indexes for querying across multiple dimensions (e.g., buyer ID, seller ID). These are managed at the serving layer, allowing new access paths without altering data pipelines. This flexibility is vital for evolving application requirements without costly ETL or data transformations. Hash-based indexes support exact lookups, while sorted indexes enable range queries. Techniques like Z-ordering and Hilbert curves can further enhance data locality for multi-dimensional secondary lookups.