Distributed UDAF Execution With Memory Spilling in Cloud Databases

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Traditional databases face challenges in handling large datasets for complex aggregate functions, leading to inefficient memory usage, increased processing times, and suboptimal performance due to stateless execution models and lack of built-in support for user-defined aggregate functions (UDAFs).

Innovation Solution

A memory-managed, distributed framework for user-defined aggregate functions in cloud databases, supporting automatic multi-cluster scaling and parallelization, with intelligent memory monitoring and spilling to disk, enabling seamless integration with SQL statements and query optimizations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If traditional database systems are used to handle large datasets for complex aggregate functions, then data storage and basic retrieval are supported, but memory usage becomes inefficient and processing times increase

Engineering Contradiction:
Improvedata aggregation performanceVSAvoidprocessing time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The patent divides the aggregate function execution into multiple phases (partial aggregation phase and final aggregation phase) and distributes computation across multiple compute nodes. Each node performs partial aggregation on local data partitions, then results are combined in the final phase. This segmentation enables parallel processing and reduces the processing time for large datasets.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a distributed memory management dimension by implementing memory-spilling mechanisms that transfer data between memory and disk storage. This adds a storage hierarchy dimension to the traditional single-memory model, enabling the system to handle larger datasets by utilizing disk space when memory is exhausted, thereby improving scalability without proportionally increasing processing time.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Productivity

If traditional database systems process large datasets, then complete data analysis is achieved, but resource consumption increases

Engineering Contradiction:
Improvedata aggregation performanceVSAvoidresource consumption
Core Design Contradiction:
ProductivityVSUse of energy by moving object

Solution Approach 1:

By segmenting the computation across multiple nodes and phases, the patent enables efficient resource utilization. Each compute node processes only its local data partition in the partial aggregation phase, minimizing data movement and reducing overall resource consumption. The final aggregation phase combines results efficiently, avoiding redundant processing.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent dynamically adjusts memory usage parameters by implementing memory-spilling mechanisms. When memory pressure is detected, the system automatically spills intermediate results to disk and retrieves them when needed, optimizing the balance between memory usage and processing efficiency. This parameter adjustment reduces resource consumption while maintaining productivity.

Inventive Principle:
Principle #35Parameter changes

3Adaptability or versatility

If user-defined aggregate functions are implemented without built-in support, then customization flexibility is achieved, but system complexity increases

Engineering Contradiction:
Improvecustom aggregate function supportVSAvoidsystem complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent implements a universal aggregate function framework that handles both built-in and user-defined functions through the same execution engine. The system provides built-in aggregate functions (SUM, COUNT, AVG, etc.) while simultaneously supporting user-defined functions through a standardized interface. This multi-functionality approach allows customization without increasing system complexity, as the same infrastructure serves both purposes.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The system automatically manages the execution of user-defined aggregate functions through intelligent query rewriting and optimization. The query optimizer automatically identifies opportunities to use user-defined functions and rewrites queries to leverage them efficiently. This self-service mechanism reduces the burden on users to manually manage complexity while maintaining adaptability.

Inventive Principle:
Principle #25Self-service

4Adaptability or versatility

If distributed computing is used for aggregate functions, then scalability is improved, but coordination overhead increases

Engineering Contradiction:
ImprovescalabilityVSAvoidcoordination overhead
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent segments the aggregate function execution into distinct phases (partial aggregation and final aggregation) that can be independently executed on different compute nodes. This phase-based segmentation reduces coordination overhead by allowing each node to work autonomously on its phase while minimizing inter-node communication. The framework automatically manages the coordination between phases, enabling scalability without proportionally increasing overhead.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS20260023733A1Memory-intensive, distributed, user defined aggregate functions in a cloud database
Publication Date: 2026.01.22 SNOWFLAKE INC
  • US20260023733A1 patent drawing
  • US20260023733A1 patent drawing
  • US20260023733A1 patent drawing

AI summary

The subject technology sends, from a child rowset operator (RSO) instance, a first request for performing a user defined aggregate function (UDAF) to a user defined function (UDF) server to initialize an aggregate state for a set of aggregation groups and update aggregated states for each aggregation group from the set of aggregation groups, the first request including a set of input rows. The subject technology receives information comprising a computation status of the UDAF. The subject technology sends, by the child RSO instance, a second request to the UDF server to update the aggregated states for each aggregation group from the set of aggregation groups, the second request including a second set of input rows. The subject technology receives an aggregate states vector with one entry per aggregation group. The subject technology sends, by the child RSO instance, the aggregate states vector to a parent RSO instance.