Multi-Phase Query Plan Caching for Faster Database Compilation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional database management systems require significant capital investment in hardware and infrastructure, are susceptible to data loss during disasters, and have limited scalability and efficiency in data access and retrieval.

Innovation Solution

A network-based database system utilizing compute service managers, execution platforms, and metadata-driven micro-partitioning to optimize query execution and resource management, enabling efficient data storage and retrieval across distributed systems.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If traditional database management systems are used with extensive hardware and infrastructure, then data storage and management capability is improved, but capital investment and operational costs increase significantly

Engineering Contradiction:
Improvedata storage capacityVSAvoidhardware infrastructure
Core Design Contradiction:
Quantity of substanceVSDevice complexity

Solution Approach 1:

The patent implements query plan caching that creates and stores optimized execution plans as reusable templates. When the same or similar queries are executed, the system retrieves and applies the cached query plan instead of generating a new one, effectively copying the optimized execution strategy to reduce computational overhead and improve performance

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The system performs query compilation and optimization in advance, storing the results in a cache before they are needed. This preliminary action allows the system to avoid repetitive compilation and optimization work for recurring queries, reducing real-time processing requirements and infrastructure demands

Inventive Principle:
Principle #10Preliminary action

2Speed

If traditional database systems are deployed with dedicated infrastructure, then data access capability is improved, but scalability and adaptability to changing workloads are limited

Engineering Contradiction:
Improvedata access speedVSAvoidworkload scalability
Core Design Contradiction:
SpeedVSAdaptability or versatility

Solution Approach 1:

The patent implements a dynamic query plan caching system that adapts to changing workloads and query patterns. The cache automatically learns from execution patterns, identifies frequently occurring queries, and maintains optimized plans for them. This dynamic adaptation allows the system to scale efficiently with varying workload demands without requiring proportional increases in infrastructure

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system automatically identifies, caches, and retrieves query plans without manual intervention. The query plan cache service autonomously monitors query patterns, generates optimized plans for recurring queries, and applies them automatically, enabling the system to self-optimize and scale adaptively to changing workloads

Inventive Principle:
Principle #25Self-service

3Measurement precision

If comprehensive query compilation and optimization is performed for every query, then query execution accuracy is improved, but processing time and computational resources increase

Engineering Contradiction:
Improvequery execution accuracyVSAvoidquery processing time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent applies query plan caching selectively based on query characteristics and frequency. Instead of caching all queries uniformly, the system identifies and caches only those queries that occur frequently and benefit from optimization. This localized approach ensures high execution accuracy for recurring queries while avoiding unnecessary processing overhead for one-time or varied queries

Inventive Principle:
Principle #3Local quality

4Productivity

If query plans are cached for reuse, then processing speed for recurring queries is improved, but memory resources and system complexity increase

Engineering Contradiction:
Improvequery processing throughputVSAvoidmemory resources
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The system caches query plans partially, storing only the most frequently occurring and beneficial query patterns. Rather than caching all possible query plans or maintaining overly comprehensive caches, the system applies selective caching based on observed query patterns, achieving significant performance improvements with moderate memory consumption

Inventive Principle:
Principle #16Partial or excessive action

Data Source

PatentUS12608378B2Multi-phase query plan caching
Publication Date: 2026.04.21 SNOWFLAKE INC
  • US12608378B2 patent drawing
  • US12608378B2 patent drawing
  • US12608378B2 patent drawing

AI summary

The subject technology receives a query, the query including a statement for performing the query. The subject technology performs a first lookup operation on a multi-phase cache based on the query. The subject technology performs, in response to a first cache miss of the multi-phase cache, parsing of the statement from the query. The subject technology performs, based on the parsing, a compilation process on the query to generate a compiled query plan, the compilation process determining an optimization and a generalization for the query. The subject technology determines that the compiled query plan is cacheable. The subject technology registers, in response to the compiled query plan being cacheable, a dummy entry in the multi-phase cache.