Query Plan Caching in Distributed Data Stores
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In shared-nothing distributed data stores, there is no cost-effective way to determine which query plans are likely to become invalid and should be removed from the cache, leading to runtime errors due to invalid plans, especially in a distributed environment where cache synchronization across nodes is challenging.
Innovation Solution
Implement a method to strategically cache query plans by assessing their complexity and presence of built-in objects, using a set of rules to decide which plans to cache, with plans generated at segment nodes typically cached and those at the master node cached only if simple or containing built-in objects.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If query plans are cached in a shared-nothing distributed data store, then execution times and costs are reduced, but the likelihood of plans becoming invalid increases due to changes in transient objects
Solution Approach 1:
The patent changes the parameter of cache invalidation from event-driven (tracking object changes) to time-driven (fixed expiration periods). Query plans are cached with predetermined time-to-live values, and automatically expired after this period regardless of whether they are still valid. This transforms the invalidation mechanism from attempting to track object state changes to a simpler temporal expiration approach.
Solution Approach 2:
The patent treats cached query plans as temporary, disposable objects with limited lifetimes rather than permanent cache entries. Each cached plan has a fixed expiration time after which it is automatically removed, accepting that some plans may expire before being reused. This approach prioritizes simplicity and reduced complexity over maximizing cache hit ratio.
2Reliability
If all objects are tracked to invalidate corresponding plans when objects are removed or changed, then plan validity is maintained, but the cost and complexity of implementation increases
Solution Approach 1:
The patent extracts the complex object tracking mechanism from the caching system and replaces it with simple time-based expiration. Instead of integrating object change tracking into the cache management, the system separates these concerns by using independent temporal expiration that does not require knowledge of object state changes.
Solution Approach 2:
Cached query plans automatically manage their own validity through predetermined expiration times without requiring external tracking systems. The cache expiration mechanism is self-sufficient, using only timestamps and duration values rather than requiring integration with object lifecycle management systems.
3Productivity
If plans are cached in a distributed fashion across multiple nodes, then performance is improved through parallel processing, but cache synchronization across nodes becomes challenging
Solution Approach 1:
The patent applies a universal cache expiration mechanism that functions identically across all distributed nodes. Each node independently manages its own cache with the same expiration logic, eliminating the need for inter-node synchronization. The universal approach to time-based expiration works consistently regardless of which node holds the cached plan.
Solution Approach 2:
The patent segments the cache management responsibility to individual nodes, with each node independently managing its own cache entries. Rather than maintaining a centralized synchronized cache, each distributed node autonomously handles cache insertion, expiration, and retrieval, simplifying the distributed system architecture.
Data Source
AI summary
The invention identifies and caches query plans in a shared-nothing distributed data store that are unlikely to become invalid because they do not reference objects that are likely to be changed or deleted. Plans that are likely to become invalid and are not cached are those plans that reference data that is partitioned across segment/query execution nodes of the data store, plans that are complex, and plans that reference objects that are not “built-in” (primitive) objects. The effect is that most plans which are generated on a query dispatch (master) node are not cached, whereas most plans generated on an execution (segment) node are cached.


