Boost Cache SQL Query Dataflow Graph Deduplication

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Boost cache for SQL queries faces challenges in maintaining data consistency and efficiency due to asynchronous queries and replication, data races, and the need to handle partial materialization of views for range queries and arbitrary filter expressions, while minimizing data processing and memory usage.

Innovation Solution

The Boost cache employs a dataflow graph with partially materialized views, GTID tracking for deduplication, and post-filtering operations to efficiently handle misses, data races, and complex queries, leveraging the Vitess cluster for data acquisition and replication, and using interval trees for range queries to manage holes and missing data.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If Boost cache stores only a subset of rows in cache, then memory usage is reduced, but cold misses and capacity misses increase

Engineering Contradiction:
Improvememory usageVSAvoidcold misses and capacity misses
Core Design Contradiction:
Quantity of substanceVSLoss of time

Solution Approach 1:

The patent divides the cache into multiple segments or tiers, allowing different types of data to be stored in different segments. This segmentation enables the system to optimize memory usage while reducing misses by organizing data according to access patterns and importance, thereby addressing both memory constraints and miss penalties.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system performs preliminary actions by pre-loading or pre-warming cache entries that are likely to be accessed soon, based on query patterns and predictions. This reduces cold misses by having data ready in cache before it is actually needed, while maintaining a manageable cache size through selective pre-loading.

Inventive Principle:
Principle #10Preliminary action

2Reliability

If Boost subscribes to VStream for replication updates, then data consistency is improved, but data races and complexity increase

Engineering Contradiction:
Improvedata consistencyVSAvoiddata race management
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent introduces an intermediary mechanism (such as a version vector system or timestamp-based ordering) that mediates between multiple replication streams. This intermediary coordinates the arrival and application of updates from different VStream sources, ensuring consistent ordering and preventing data races without requiring complex coordination logic in each cache node.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The system implements feedback mechanisms where cache nodes report their state and received updates to a coordination service, which then provides guidance on the correct ordering and application of updates. This feedback loop enables the system to maintain consistency across distributed nodes while managing complexity through centralized coordination.

Inventive Principle:
Principle #23Feedback

3Reliability

If Boost performs read-through queries for cache misses, then data freshness is improved, but query latency and processing overhead increase

Engineering Contradiction:
Improvedata freshnessVSAvoidquery latency
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system performs preliminary actions by anticipating future query needs and pre-fetching data that is likely to be requested soon. This reduces the latency of future queries by having the data already in cache, while the initial pre-fetch operations are batched or optimized to minimize their impact on overall system performance.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent uses copying mechanisms where data is replicated from the source database to the cache in optimized batches rather than individual row-by-row operations. This copying approach reduces the overhead of read-through queries by transferring multiple rows in a single operation, thereby improving data freshness while minimizing latency impact.

Inventive Principle:
Principle #26Copying

4Quantity of substance

If Boost implements partially materialized views, then memory usage is reduced, but query complexity and processing overhead increase

Engineering Contradiction:
Improvememory usageVSAvoidquery processing
Core Design Contradiction:
Quantity of substanceVSDevice complexity

Solution Approach 1:

The system implements partially materialized views by materializing only the portions of data that are most frequently accessed or most important for query performance. This partial materialization reduces memory usage compared to full materialization, while still providing performance benefits for common query patterns. The system selectively applies materialization based on access patterns and importance metrics.

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS12182118B1Boost cache for SQL queries with write order consistency, data race management, partially materialized views for range queries, and arbitrary filter expressions
Publication Date: 2024.12.31 PLANETSCALE INC
  • US12182118B1 patent drawing
  • US12182118B1 patent drawing
  • US12182118B1 patent drawing

AI summary

Data races are resolved and rows are deduplicated between upqueries and updates to an underlying database, in a database caching layer on top of the underlying database. The caching layer maintains a dataflow graph of nodes representing row data of the underlying database, database operators, and partially or fully materialized queries, wherein queries that use common row data and/or database operators share corresponding nodes. A data race resolution and row deduplication algorithm may be applied on every node that contains a partial materialization, and is correct regardless of how many times this node is reused throughout the dataflow graph. It prevents any of the nodes from seeing duplicated packets between the external upqueries that are originated from each node and any underlying database change events which the node observes. It does so by tagging the records in change events with unique identifiers for the paths in the graph that have seen them before, and by delaying any of the change events that could conflict with any existing in-flight external upqueries.