User-Defined Query Logic Storage for Database Filtering

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing systems face challenges in efficiently filtering entity data in databases using user-defined query logic, particularly in evaluating multiple segments simultaneously while avoiding SQL injection attacks.

Innovation Solution

The system creates data tables to store user-defined segment definitions and criteria, transforms these definitions into sets of filter definition tuples, and composes a user-defined query that interprets these tuples as native database operations, allowing for simultaneous evaluation of multiple segments in a single SQL query.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If user-defined query logic is stored in a database for filtering entity data, then filtering efficiency and simultaneous segment evaluation are improved, but system complexity increases

Engineering Contradiction:
Improvefiltering efficiencyVSAvoidsystem complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system segments query logic into distinct components: segment definitions, criteria, and filter definition tuples are stored as separate data tables. This allows the complex query composition process to be broken down into manageable steps where each table serves a specific function in the overall filtering operation.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary transformation layer that converts user-defined segment definitions into filter definition tuples, which are then interpreted as native database operations. This intermediary format acts as a bridge between user-friendly segment definitions and efficient database queries, resolving the complexity by providing a standardized intermediate representation.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Loss of time

If multiple segments are evaluated simultaneously in a single SQL query, then processing time is reduced, but vulnerability to SQL injection attacks increases

Engineering Contradiction:
Improveprocessing timeVSAvoidSQL injection vulnerability
Core Design Contradiction:
Loss of timeVSObject-affected harmful factors

Solution Approach 1:

The system extracts and stores query logic parameters (filter definition tuples) in the database separately from the query execution mechanism. By taking out the query construction step and storing it as pre-defined logic, the system eliminates the need to assemble SQL queries from user-provided strings, thereby removing the SQL injection vulnerability while maintaining simultaneous evaluation capability.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent converts the potential harm of SQL injection by using a safe alternative: instead of constructing queries from user strings, the system uses a query language that is safe to execute even when parameters come from user input. The filter definition tuples are interpreted as native operations, transforming a vulnerable approach into a secure one while preserving performance benefits.

Inventive Principle:
Principle #22Blessing in disguise (Convert harm into benefit)

3Ease of operation

If user-defined segment definitions are transformed into sets of filter definition tuples, then query composition becomes more manageable, but transformation complexity increases

Engineering Contradiction:
Improvequery compositionVSAvoidtransformation complexity
Core Design Contradiction:
Ease of operationVSDevice complexity

Solution Approach 1:

The system changes the parameter representation from natural language segment definitions to a standardized set of filter definition tuples with specific syntax and structure. This parameter transformation makes query composition more manageable by providing a consistent format that can be systematically processed, while the transformation itself is encapsulated in a dedicated component that handles the complexity.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS20250181624A1Storing User-Defined Query Logic in a Database for Filtering Entity Data
Publication Date: 2025.06.05 KLAVIYO INC
  • US20250181624A1 patent drawing
  • US20250181624A1 patent drawing
  • US20250181624A1 patent drawing

AI summary

Apparatuses, methods, and systems for filtering entities within a database based on rules of a user-defined segment definition. One method includes creating data tables for storing user-defined segment definitions in the database, the data tables including the user-defined segment definitions and criteria, receiving new user-defined segment definitions, transforming the new user-defined segment definitions, storing the transformed new user-defined segment definitions in the database, composing a user-defined query based on the transformed new user-defined segment definitions as stored in the database, wherein the user-defined query contains logic that interprets the filter definition tuples as native operations provided by the database, and running the composed user-defined query against the data tables to determine which of the entities qualify for membership in new segments based on each of the new user-defined segment definitions as determined by the logic contained in the composed user-defined query.