# US 12,007,993 B1 · Multi database queries

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

- Number: US 12,007,993 B1
- Document ID: US12007993B1
- Status: Granted
- Kind: B1
- Application number: 18/345,900
- Filed: 2023-06-30
- Granted: 2024-06-11
- Earliest claimed: 2023-06-30
- Assignees: Snowflake Inc.
- Applicants: Snowflake Inc.
- Inventors: Fabio Angius; Chen Luo; Sarvesh Singh
- Web page: https://patentgrep.com/patent/US12007993B1

## CPC

- G06F 16/24542: {Plan optimisation}
- G06F 16/2329: {using versioning}
- G06F 16/24535: {of sub-queries or views}
- G06F 16/285: {Clustering or classification}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques for multi database query processing are described. Objects located in a plurality of databases referenced in a query can be compiled. A connection string based on the compiled objects can be generated. The connection string can include mapping information related to the related to the plurality of databases and cluster information of where the plurality of databases are stored in the network-based data system. The connection string can then be included in a query plan to allow for execution of the query plan using the connection string to access the objects in the plurality of databases.

## Claims

### Claim 1

A method comprising:
receiving, by at least one processor of a network-based data system, a query;
determining that the query references a plurality of databases stored in the network-based data system;
compiling objects referenced in the query associated with the plurality of databases;
generating a connection string based on the compiled objects, the connection string including mapping information related to the plurality of databases and cluster information describing locations of the plurality of databases are stored in the network-based data system;
generating a query plan including a set of operators to execute the query, the query plan including the connection string;
transmitting the query plan to one or more execution platforms in the network-based data system; and
executing, by the one or more execution platforms, the query plan using the connection string to access the objects in the plurality of databases, executing the query plan includes:
retrieving read versions of the objects from the plurality of databases using the connection string information in the query plan;
retrieving transaction status information for the objects;
generating transaction contexts for the objects based on the transaction status information; and
performing a scan operator of the set of operators in the query plan on at least one of the objects using the respective transaction context of the object.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
parsing the query plan by the one or more execution platforms;
and
executing remaining operators of the set of operators to generate results for the query.

### Claim 3 (depends on 2)

The method of claim 2, wherein transaction contexts provide information regarding which rows in the object are committed and uncommitted.

### Claim 4 (depends on 2)

The method of claim 2, wherein transaction contexts can be singleton objects maintained using database identification as a key.

### Claim 5 (depends on 1)

The method of claim 1, wherein the plurality of databases include transactional databases.

### Claim 6 (depends on 5)

The method of claim 5, wherein the transactional databases are organized in different cluster groups.

### Claim 7

A non-transitory machine-storage medium embodying instructions that, when executed by a machine, cause the machine to perform operations comprising:
receiving, by at least one processor of a network-based data system, a query;
determining that the query references a plurality of databases stored in the network-based data system;
compiling objects referenced in the query associated with the plurality of databases;
generating a connection string based on the compiled objects, the connection string including mapping information related to the plurality of databases and cluster information describing locations of the plurality of databases are stored in the network-based data system;
generating a query plan including a set of operators to execute the query, the query plan including the connection string;
transmitting the query plan to one or more execution platforms in the network-based data system; and
executing, by the one or more execution platforms, the query plan using the connection string to access the objects in the plurality of databases, executing the query plan includes:
retrieving read versions of the objects from the plurality of databases using the connection string information in the query plan;
retrieving transaction status information for the objects;
generating transaction contexts for the objects based on the transaction status information; and
performing a scan operator of the set of operators in the query plan on at least one of the objects using the respective transaction context of the object.

### Claim 8 (depends on 7)

The non-transitory machine-storage medium of claim 7, further comprising:
parsing the query plan by the one or more execution platforms;
and
executing remaining operators of the set of operators to generate results for the query.

### Claim 9 (depends on 8)

The non-transitory machine-storage medium of claim 8, wherein transaction contexts provide information regarding which rows in the object are committed and uncommitted.

### Claim 10 (depends on 8)

The non-transitory machine-storage medium of claim 8, wherein transaction contexts can be singleton objects maintained using database identification as a key.

### Claim 11 (depends on 7)

The non-transitory machine-storage medium of claim 7, wherein the plurality of databases include transactional databases.

### Claim 12 (depends on 11)

The non-transitory machine-storage medium of claim 11, wherein the transactional databases are organized in different cluster groups.

### Claim 13

A system comprising:
at least one hardware processor; and
at least one memory storing instructions that, when executed by the at least one hardware processor, cause the at least one hardware processor to perform operations comprising:
receiving, by a network-based data system, a query;
determining that the query references a plurality of databases stored in the network-based data system;
compiling objects referenced in the query associated with the plurality of databases;
generating a connection string based on the compiled objects, the connection string including mapping information related to the plurality of databases and cluster information describing locations of the plurality of databases are stored in the network-based data system;
generating a query plan including a set of operators to execute the query, the query plan including the connection string;
transmitting the query plan to one or more execution platforms in the network-based data system; and
executing, by the one or more execution platforms, the query plan using the connection string to access the objects in the plurality of databases, executing the query plan includes:
retrieving read versions of the objects from the plurality of databases using the connection string information in the query plan;
retrieving transaction status information for the objects;
generating transaction contexts for the objects based on the transaction status information; and
performing a scan operator of the set of operators in the query plan on at least one of the objects using the respective transaction context of the object.

### Claim 14 (depends on 13)

The system of claim 13, the operations further comprising:
parsing the query plan by the one or more execution platforms;
and
executing remaining operators of the set of operators to generate results for the query.

### Claim 15 (depends on 14)

The system of claim 14, wherein transaction contexts provide information regarding which rows in the object are committed and uncommitted.

### Claim 16 (depends on 14)

The system of claim 14, wherein transaction contexts can be singleton objects maintained using database identification as a key.

### Claim 17 (depends on 13)

The system of claim 13, wherein the plurality of databases include transactional databases.

### Claim 18 (depends on 17)

The system of claim 17, wherein the transactional databases are organized in different cluster groups.
