Promise Keys in Result Caches for Concurrent Query Deduplication
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database systems face inefficiencies due to redundant query executions and computations when the same query is submitted contemporaneously by multiple clients, leading to increased workloads and resource consumption.
Innovation Solution
Implementing a cache system that uses promise keys for query result requests, allowing database clients to wait for query results to be cached instead of executing redundant queries, thereby reducing redundant query executions and computations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Use of energy by moving object
If result caching is employed to avoid query re-execution, then resource consumption is reduced, but redundant query executions occur when multiple clients submit the same query contemporaneously
Solution Approach 1:
The system performs a preliminary check in the result cache before executing a query. When a query is received, the system first checks if the result already exists in the cache, and only executes the query if it's not found, preventing redundant executions before they occur.
Solution Approach 2:
The result cache acts as an intermediary layer between the query receiver and the query execution engine. This intermediary checks for existing results and coordinates between multiple clients to avoid simultaneous query executions for the same query, resolving the contradiction between resource savings and execution efficiency.
2Loss of time
If query results are cached to reduce workloads, then processing time is reduced for subsequent queries, but the system complexity increases due to cache management
Solution Approach 1:
The system creates a simplified copy of the query result in the cache with an associated key, rather than storing the entire complex query structure. This copying approach reduces the complexity of cache management while maintaining fast retrieval, as the cache only needs to store and compare keys and results, not the full query logic.
Solution Approach 2:
The cache system automatically manages itself by generating unique keys for queries and handling the insertion and retrieval operations without requiring complex external coordination. This self-service mechanism reduces the apparent complexity for the database system while maintaining efficient caching operations.
Data Source
AI summary
Methods, systems, and computer-readable storage media for receiving, from a database client, an asynchronous lookup request including a key representative of a query and, in response, returning a value handle including a value promise, receiving, from the database client, a get request based on the value promise, determining that a query result corresponding to the key is unavailable in a results cache and that the key is in an unlocked state, and in response, returning a null pointer and a first key lock status to the first database client, receiving, from the database client, a key, value pair including the key and a value, the value comprising the query result, and storing the key, value pair in the results cache.


