IP Library Granted Patent US 12,135,749
Granted Patent B2
US 12,135,749 · App. 17/886,445 · Granted Nov 5, 2024

Channel based flow control of data during execution of database queries

Inventor: Adam Szymański (Warsaw, PL)
Assignee: OXLA SP. Z O.O.
G06F16/90335
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,135,749
App. No.
17/886,445
Granted
Nov 5, 2024
Kind
B2
Abstract

A database system generates an execution plan including multiple operators for processing a database query, for example, a join query or a group by query. The database system allocates a set of threads. Threads communicate with other threads via blocking channels. A blocking channel includes a buffer of a fixed capacity. The database system processes the database query by streaming data through operators of the execution plan. A thread sends data generated by an operator to another thread via the blocking channel if the buffer of the blocking channel has available capacity to store the data, or else the thread blocks until the buffer has capacity to store the data. Similarly, a thread receives data generated by an operator of another thread via the blocking channel if the buffer of the blocking channel has available data, or else the thread blocks until the buffer has data.

Claims (52)

1. A computer-implemented method for executing database queries, the computer-implemented method comprising:

receiving, by a database system, a database query for processing data stored in one or more input tables;

generating an execution plan for executing the database query, the execution plan comprising a plurality of operators, wherein at least an operator receives data output by another operator or generates output provided as input to another operator;

allocating a set of threads for executing operators of the execution plan, each thread processing one or more operators, the set of threads comprising at least a first thread executing a first operator and a second thread executing a second operator, wherein the first thread communicates with the second thread via a blocking channel, the blocking channel comprising a buffer of fixed capacity for storing data; and

processing the database query by streaming data through the operators of the execution plan, wherein the first thread provides output of the first operator to the second operator of the second thread via the blocking channel, the processing comprising:

sending, by the first thread, data generated by the first operator to the second thread executing the second operator via the blocking channel if the buffer of the blocking channel has available capacity to store the data, and

blocking execution of the first thread if the buffer of the blocking channel is full, wherein execution of the first thread is blocked until the buffer of the blocking channel has capacity to store the data generated by the first operator.

2. The computer-implemented method of claim 1 , wherein the blocking channel allows a thread to perform one or more of:

a push operation that pushes data to the buffer of the blocking channel, wherein the push operation causes the thread to block if the buffer of the blocking channel is full; and

a pull operation that pulls data from the buffer of the blocking channel, wherein the pull operation causes the thread to block if the buffer of the blocking channel is empty.

3. The computer-implemented method of claim 1 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the second operator performed by the second thread receives inputs from multiple threads.

4. The computer-implemented method of claim 1 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the first operator performed by the first thread sends the output of the first operator to multiple threads.

5. The computer-implemented method of claim 1 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that at least one of the first thread or the second thread performs a non-linear operator, wherein a non-linear operator performs at least one of: receiving of data from a first plurality threads or sending data to a second plurality of threads.

6. The computer-implemented method of claim 1 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the first operator performed by the first thread performs a broadcast of data to a plurality of threads.

7. The computer-implemented method of claim 1 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the second operator performed by the second thread performs an aggregation of data stored in a table.

8. The computer-implemented method of claim 1 , wherein processing the database query further comprises:

receiving, by the second thread, data stored in the buffer of the blocking channel for performing the second operator if there is data available in the buffer of the blocking channel, and

blocking execution of the second thread if the buffer of the blocking channel is empty, wherein execution of the second thread is blocked until the buffer of the blocking channel has data available for processing by the second operator.

9. A non-transitory computer readable storage medium storing instructions that when executed by one or more computer processors, cause the one or more computer processors to perform steps comprising:

receiving, by a database system, a database query for processing data stored in one or more input tables;

generating an execution plan for executing the database query, the execution plan comprising a plurality of operators, wherein at least an operator receives data output by another operator or generates output provided as input to another operator;

allocating a set of threads for executing operators of the execution plan, each thread processing one or more operators, the set of threads comprising at least a first thread executing a first operator and a second thread executing a second operator, wherein the first thread communicates with the second thread via a blocking channel, the blocking channel comprising a buffer of fixed capacity for storing data; and

processing the database query by streaming data through the operators of the execution plan, wherein the first thread provides output of the first operator to the second operator of the second thread via the blocking channel, the processing comprising:

sending, by the first thread, data generated by the first operator to the second thread executing the second operator via the blocking channel if the buffer of the blocking channel has available capacity to store the data, and

blocking execution of the first thread if the buffer of the blocking channel is full, wherein execution of the first thread is blocked until the buffer of the blocking channel has capacity to store the data generated by the first operator.

10. The non-transitory computer readable storage medium of claim 9 , wherein the blocking channel allows a thread to perform one or more of:

a push operation that pushes data to the buffer of the blocking channel, wherein the push operation causes the thread to block if the buffer of the blocking channel is full; and

a pull operation that pulls data from the buffer of the blocking channel, wherein the pull operation causes the thread to block if the buffer of the blocking channel is empty.

11. The non-transitory computer readable storage medium of claim 9 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the second operator performed by the second thread receives inputs from multiple threads.

12. The non-transitory computer readable storage medium of claim 9 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the first operator performed by the first thread sends the output of the first operator to multiple threads.

13. The non-transitory computer readable storage medium of claim 9 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that at least one of the first thread or the second thread performs a non-linear operator, wherein a non-linear operator performs at least one of: receiving of data from a first plurality threads or sending data to a second plurality of threads.

14. The non-transitory computer readable storage medium of claim 9 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the first operator performed by the first thread performs a broadcast of data to a plurality of threads.

15. The non-transitory computer readable storage medium of claim 9 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that the second operator performed by the second thread performs an aggregation of data stored in a table.

16. The non-transitory computer readable storage medium of claim 9 , wherein the instructions for processing the database query further cause the one or more computer processors to perform steps comprising:

receiving, by the second thread, data stored in the buffer of the blocking channel for performing the second operator if there is data available in the buffer of the blocking channel, and

blocking execution of the second thread if the buffer of the blocking channel is empty, wherein execution of the second thread is blocked until the buffer of the blocking channel has data available for processing by the second operator.

17. A computer system comprising:

one or more computer processors; and

a non-transitory computer readable storage medium storing instructions that when executed by the one or more computer processors, cause the one or more computer processors to perform steps comprising:

receiving, by a database system, a database query for processing data stored in one or more input tables;

generating an execution plan for executing the database query, the execution plan comprising a plurality of operators, wherein at least an operator receives data output by another operator or generates output provided as input to another operator;

allocating a set of threads for executing operators of the execution plan, each thread processing one or more operators, the set of threads comprising at least a first thread executing a first operator and a second thread executing a second operator, wherein the first thread communicates with the second thread via a blocking channel, the blocking channel comprising a buffer of fixed capacity for storing data; and

processing the database query by streaming data through the operators of the execution plan, wherein the first thread provides output of the first operator to the second operator of the second thread via the blocking channel, the processing comprising:

sending, by the first thread, data generated by the first operator to the second thread executing the second operator via the blocking channel if the buffer of the blocking channel has available capacity to store the data, and

blocking execution of the first thread if the buffer of the blocking channel is full, wherein execution of the first thread is blocked until the buffer of the blocking channel has capacity to store the data generated by the first operator.

18. The computer system of claim 17 , wherein the blocking channel allows a thread to perform one or more of:

a push operation that pushes data to the buffer of the blocking channel, wherein the push operation causes the thread to block if the buffer of the blocking channel is full; and

a pull operation that pulls data from the buffer of the blocking channel, wherein the pull operation causes the thread to block if the buffer of the blocking channel is empty.

19. The computer system of claim 17 , wherein the blocking channel is introduced between the first thread and the second thread responsive to determining that at least one of the first thread or the second thread performs a non-linear operator, wherein a non-linear operator performs at least one of: receiving of data from a first plurality threads or sending data to a second plurality of threads.

20. The computer system of claim 17 , wherein the instructions for processing the database query further cause the one or more computer processors to perform steps comprising:

receiving, by the second thread, data stored in the buffer of the blocking channel for performing the second operator if there is data available in the buffer of the blocking channel, and

blocking execution of the second thread if the buffer of the blocking channel is empty, wherein execution of the second thread is blocked until the buffer of the blocking channel has data available for processing by the second operator.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 15, 2025
From: OXLA SP. Z O.O
To: REDPANDA DATA, INC.
Reel/Frame 073213/0277 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 5, 2022
From: SZYMANSKI, ADAM
To: OXLA SP. Z O.O.
Reel/Frame 061981/0955 →
Priority Claims (1)
PL 441869 · Jul 28, 2022 · national
Continuity (1)
Related Publication 20240037151A1 · Feb 1, 2024