How Pinterest Cut Query Latency by 50% with StarRocks Migration
Pinterest migrated its Partner Insights analytics from Druid to StarRocks, achieving a 50% reduction in p90 latency, a six‑fold cost‑performance improvement, and simplified data ingestion, illustrating the benefits of a modern MPP database for real‑time ad analytics.
Background
Pinterest runs Partner Insights, a real‑time analytics service for advertisers. The platform must ingest and aggregate high‑cardinality, multi‑dimensional metrics for millions of advertisers, requiring low‑latency queries and frequent data refreshes.
Limitations of the legacy Druid stack
Cost escalation – Scaling Druid clusters incurred rapidly increasing infrastructure spend.
Insufficient SQL support – Druid’s query engine lacked full ANSI‑SQL compatibility, making complex ad‑hoc analysis difficult.
Complex ingestion pipeline – Data had to be loaded via external MapReduce jobs and custom JSON ingestion specs, adding operational overhead.
Performance bottlenecks – Multi‑dimensional, high‑concurrency queries suffered latency spikes under load.
Migration to StarRocks
Pinterest replaced Druid with StarRocks, a next‑generation MPP analytical database that provides:
Native ANSI‑SQL interface for ad‑hoc reporting.
Simplified ingestion using standard INSERT statements and bulk load utilities, eliminating JSON‑based configuration.
Columnar storage with vectorized execution and distributed query planning, delivering low‑latency responses for high‑cardinality dimensions.
Implementation details
Data from the upstream event pipeline is now streamed into StarRocks tables via INSERT INTO ... SELECT statements or the StarRocks Stream Load API. The schema is defined once in StarRocks, and new advertiser‑specific metrics are added as columns without changing the ingestion framework. StarRocks’ automatic partitioning on time and advertiser ID ensures data is distributed evenly across nodes.
Results
90th‑percentile query latency decreased by ~50% while the cluster size was reduced to 32% of the original Druid instance count.
Overall cost‑performance improved roughly six‑fold.
Data freshness improved to a 10‑second ingest‑to‑query window.
Operational complexity dropped because JSON ingestion configs were removed; analysts can now write standard SQL to create or modify tables.
Future work
Pinterest is evaluating StarRocks features such as query caching and materialized views to further reduce latency for high‑concurrency workloads.
StarRocks
StarRocks is an open‑source project under the Linux Foundation, focused on building a high‑performance, scalable analytical database that enables enterprises to create an efficient, unified lake‑house paradigm. It is widely used across many industries worldwide, helping numerous companies enhance their data analytics capabilities.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
