# US 2025/0156430 A1 · Query Processing with Machine Learning

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2025/0156430 A1
- Document ID: US20250156430A1
- Status: Published application
- Kind: A1
- Application number: 19/022,565
- Filed: 2025-01-15
- Published: 2025-05-15
- Earliest claimed: 2019-10-29
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Konstantinos KARANASOS; Matteo INTERLANDI; Fotios PSALLIDAS; Rathijit SEN; Kwanghyun PARK; Ivan POPIVANOV; Subramaniam VENKATRAMAN KRISHNAN; Markus WEIMER; Yuan YU; Raghunath RAMAKRISHNAN; Carlo Aldo CURINO; Doris Suiyi XIN; Karla Jean SAUR
- Web page: https://patentgrep.com/patent/US20250156430A1

## CPC

- G06F 16/2458: Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06N 3/08: Learning methods
- G06F 16/284: {Relational databases}
- G06N 5/01: Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
- G06N 5/04: Inference or reasoning models
- G06N 20/00: Machine learning
- G06N 3/105: {Shells for specifying net layout}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

The description relates to executing an inference query relative to a database management system, such as a relational database management system. In one example a trained machine learning model can be stored within the database management system. An inference query can be received that applies the trained machine learning model on data local to the database management system. Analysis can be performed on the inference query and the trained machine learning model to generate a unified intermediate representation of the inference query and the trained model. Cross optimization can be performed on the unified intermediate representation. Based upon the cross-optimization, a first portion of the unified intermediate representation to be executed by a database engine of the database management system can be determined, and, a second portion of the unified intermediate representation to be executed by a machine learning runtime can be determined.

## Claims

### Claim at position 1

1-21. (canceled)

### Claim 22

A device-implemented method, comprising:
receiving an inference query for a database having a database relational engine and an integral machine learning runtime;
performing static analysis of the inference query to generate a graph representing the inference query with one or more relational database operators and one or more machine learning operators;
performing cross-optimization of the graph based, at least in part, upon the one or more relational database operators and the one or more machine learning operators; and
generating code for the database based at least in part on the cross-optimization,
wherein, when executed, the code produces a result of the inference query based at least in part on the one or more relational operators and the one or more machine learning operators.

### Claim 23 (depends on 22)

The device-implemented method of claim 22, wherein the graph is a directed acyclic graph.

### Claim 24 (depends on 23)

The device-implemented method of claim 23, wherein the directed acyclic graph includes nodes representing individual relational database operators, other nodes representing individual machine learning operators, and directed edges connecting the nodes and the other nodes.

### Claim 25 (depends on 22)

The device-implemented method of claim 22, wherein the graph includes:
a first node representing a relational database operator that performs a join operation on data from multiple data sources to obtain joined data; and
a second node representing a machine learning operator that performs a machine learning operation based at least in part on the joined data.

### Claim 26 (depends on 25)

The device-implemented method of claim 25, wherein the graph includes a third node representing another relational database operator that performs a select operation based at least in part on output of the machine learning operation.

### Claim 27 (depends on 26)

The device-implemented method of claim 26, wherein the join data is obtained from multiple relational data tables.

### Claim 28 (depends on 22)

The device-implemented method of claim 22, wherein the cross-optimization is based at least on identifying zero weights in a machine learning model that implements a particular machine learning operator.

### Claim 29 (depends on 28)

The device-implemented method of claim 28, wherein the cross-optimization involves:
identifying features representing input data accessed by the inference query; and
removing a subset of the features that would be multiplied by the zero weights when processed by the machine learning model.

### Claim 30 (depends on 29)

The device-implemented method of claim 29, wherein the machine learning model is a linear regression model.

### Claim 31 (depends on 22)

The device-implemented method of claim 22, further comprising:
executing the code on one or more data sources of the database, the executing providing a result; and
outputting the result in response to the inference query.

### Claim 32 (depends on 31)

The device-implemented method of claim 31, the one or more data sources comprising multiple relational data tables.

### Claim 33

A system, comprising:
a processor; and
a computer storage media having computer-executable instructions stored thereupon which, when executed by the processor, cause the processor to:
receive an inference query for a database having a database relational engine and an integral machine learning runtime;
perform static analysis of the inference query to generate a graph representing the inference query with one or more relational database operators and one or more machine learning operators;
perform cross-optimization of the graph based, at least in part, upon the one or more relational database operators and the one or more machine learning operators; and
generate code for the database based at least in part on the cross-optimization,
wherein, when executed, the code produces a result of the inference query based at least in part on the one or more relational operators and the one or more machine learning operators.

### Claim 34 (depends on 33)

The system of claim 33, wherein the computer-executable instructions, when executed by the processor, cause the processor to:
execute the code on one or more data sources of the database, the executing providing a result; and
output the result in response to the inference query.

### Claim 35 (depends on 34)

The system of claim 34, the one or more data sources comprising multiple relational data tables.

### Claim 36 (depends on 35)

The system of claim 35, wherein the graph includes:
a first node representing a relational database operator that performs a join operation on data from the multiple relational data tables to obtain joined data; and
a second node representing a machine learning operator that performs a machine learning operation based at least in part on the joined data.

### Claim 37 (depends on 36)

The system of claim 36, wherein the graph includes a third node representing another relational database operator that performs a select operation based at least in part on output of the machine learning operation.

### Claim 38 (depends on 33)

The system of claim 33, wherein the integral machine learning runtime of the database comprises a dynamically-linked library that runs in-process with the database relational engine.

### Claim 39 (depends on 33)

The system of claim 33, wherein the one or more machine learning operators correspond to at least one of a decision tree model or a regression model.

### Claim 40

A computer storage media storing computer-readable instructions which, when executed by a processor, cause the processor to perform acts comprising:
receiving an inference query for a database having a database relational engine and an integral machine learning runtime;
performing static analysis of the inference query to generate a graph representing the inference query with one or more relational database operators and one or more machine learning operators;
performing cross-optimization of the graph based, at least in part, upon the one or more relational database operators and the one or more machine learning operators; and
generating code for the database based at least in part on the cross-optimization,
wherein, when executed, the code produces a result of the inference query based at least in part on the one or more relational operators and the one or more machine learning operators.

### Claim 41 (depends on 40)

The computer storage media of claim 40, the acts further comprising:
generating a result for the inference query by executing the code on data from a relational database.
