IP Library Granted Patent US 8,762,366
Granted Patent B1
US 8,762,366 · App. 13/835,795 · Granted Jun 24, 2014

Executing database queries using multiple processors

Inventors: Santiago Becerra (Del Mar, CA); Santiago E. Becerra (Del Mar, CA); Alex C. Schaefer (Solana Beach, CA); John McInerney (La Mesa, CA); Patrick Cheng (San Diego, CA)
Assignee: MeLLmo Inc.
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 8,762,366
App. No.
13/835,795
Granted
Jun 24, 2014
Kind
B1
Abstract

A system and a method are disclosed for efficiently executing database queries using a computing device that includes a central processing unit (CPU) and a processing unit based on single instruction multiple thread (SIMT) architecture, for example, a GPU. A query engine determines a target processing unit to execute a database query based on factors including the type and amount of data processed by the query, the complexity of the query, and the current load on the processing units. An intermediate executable representation generator generates an intermediate executable representation for executing a query on a database virtual machine. If the query engine determines that the database query should be executed on an SIMT based processing unit, a native code generator generates native code from the intermediate executable representation. The native code is optimized for execution using a particular processing unit.

Claims (70)

1. A method for executing database queries, comprising:

receiving a database query for execution by a database system, the database system configured to process database queries using a first processing unit including one or more central processing units (CPUs) and a second processing unit including one or more single instruction multiple thread based processing units;

generating, by the database system, an intermediate executable representation including code for processing the database query, the code comprising instructions for execution by a database virtual machine, the processing performed by executing operators representing portions of computations for processing the database query;

generating native code from the intermediate executable representation, wherein the native code is optimized for execution on the second processing unit, wherein generating native code comprises:

identifying a conditional branch statement in which the execution of instructions on a first branch takes more units of time than execution of instructions on a second branch of the code; and

introducing one or more dummy instructions in the second branch of code, wherein the number of dummy instructions introduced in the second branch of code is determined so as to cause the execution of the first branch and the second branch to take the same number of units of time for execution;

compiling the native code to executable code;

selecting, by the database system, a target processing unit for executing an operator of the database query based on factors comprising the data processed by the query;

responsive to selection of the second processing unit for executing the operator of the database query, executing the compiled executable code by the database system using the second processing unit; and

sending the result of execution of the query.

2. The method of claim 1 , further comprising:

responsive to the selection of the first processing unit as the target processing unit for executing the operator of the database query, executing the code of the intermediate executable representation by the database system using the database virtual machine.

3. The method of claim 1 , wherein the second processing unit is a graphical computing unit (GPU).

4. The method of claim 1 , further comprising:

determining an estimate of the size of data processed by the operator of the database query; and

wherein the factors considered for selecting the target processing unit for executing an operator of the database query include the size of the data processed by the operator of the database query.

5. The method of claim 4 , further comprising:

selecting the second processing unit as the processing unit for executing the operator of the database query responsive to the estimate of the size of the data processed by the operator of the database query exceeding a threshold value.

6. The method of claim 4 , further comprising:

selecting the first processing unit as the processing unit for executing the query responsive to the estimate of the size of the query being below a threshold value.

7. The method of claim 1 , wherein the factors considered for selecting the target processing unit for executing the operator of the database query include a data type of data processed by the operator of the database query.

8. The method of claim 1 , wherein the factors considered for selecting the target processing unit for executing the operator of the database query include an estimate of a complexity of the database query.

9. The method of claim 1 , wherein the factors considered for selecting the target processing unit for executing the operator of the database query include an estimate of a current amount of work on each of the first processing unit and the second processing unit.

10. The method of claim 1 , further comprising:

responsive to selecting the second processing unit for executing the query, arranging the data processed by the operator of the database query as equal sized portions of data, the arranging comprising adding padding bytes to a first portion of data to match a size of the first portion of data with a size of the second portion of data.

11. The method of claim 1 , wherein execution of the generated native code requires fewer synchronization operations in the single instruction multiple thread based processing units compared to execution of the instructions of the intermediate executable representation.

12. A computer readable non-transitory storage medium storing instructions of a database system thereon, the instructions when executed, cause the database system to:

receive a database query for execution by the database system, the database system configured to process database queries on a first processing unit including one or more central processing units (CPUs) and a second processing unit including one or more single instruction multiple thread based processing units;

generate an intermediate executable representation including code for processing the database query, the code comprising instructions for execution by a database virtual machine, the processing performed by executing operators representing portions of computations for processing the database query;

generate native code from the intermediate executable representation, wherein the native code is optimized for execution on the second processing unit, wherein the instructions to generate native code cause the processor to:

identify a conditional branch statement in which the execution of instructions on a first branch takes more units of time than execution of instructions on a second branch of the code; and

introduce one or more dummy instructions in the second branch of code, wherein the number of dummy instructions introduced in the second branch of code is determined so as to cause the execution of the first branch and the second branch to take the same number of units of time for execution;

compile the native code to executable code; and

select a target processing unit for executing an operator of the database query based on factors comprising the data processed by the query;

responsive to selection of the second processing unit for executing the operator of the database query execute the compiled executable code using the second processing unit; and

send the result of execution of the query.

13. The computer readable non-transitory storage medium of claim 12 , wherein the instructions when executed, further cause the database system to:

determine an estimate of the size of data processed by the operator of the database query; and

wherein the factors considered for selecting the target processing unit for executing an operator of the database query include the size of the data processed by the operator of the database query.

14. The computer readable non-transitory storage medium of claim 13 , wherein the instructions when executed, further cause the database system to:

select the second processing unit for executing the query responsive to the estimate of the size of the query exceeding a threshold value; and

select the first processing unit for executing the query responsive to the estimate of the size of the query being below a threshold value.

15. The computer readable non-transitory storage medium of claim 12 , wherein the factors considered for selecting the target processing unit for executing the database query include one or more of a data type of data processed by the operator of the database query, a complexity of the database query, and a current amount of work on each of the first processing unit and the second processing unit.

16. The computer readable non-transitory storage medium of claim 12 , wherein the instructions when executed, further cause the database system to:

responsive to the selection of the first processing unit as the target processing unit for executing the operator of the database query, execute the code of the intermediate executable representation by the database system using the database virtual machine.

17. The computer readable non-transitory storage medium of claim 12 , wherein the instructions when executed, further cause the database system to:

responsive to selecting the second processing unit for executing the query, arranging the data processed by the operator of the database query as equal sized portions of data, the arranging comprising adding padding bytes to a first portion of data to match a size of the first portion of data with a size of the second portion of data.

18. The computer readable non-transitory storage medium of claim 12 , wherein execution of the generated native code requires fewer synchronization operations in the single instruction multiple thread based processing units compared to execution of the instructions of the intermediate executable representation.

19. A computer-implemented system for processing database queries, the system comprising:

a first processing unit comprising one or more central processing units;

a second processing unit comprising one or more single instruction multiple thread based processing units; and

a computer readable non-transitory storage medium storing instructions for a database system, the instructions when executed cause the database system to:

receive a database query for execution by the database system;

generate an intermediate executable representation including code for processing the database query, the code comprising instructions for execution by a database virtual machine, the processing performed by executing operators representing portions of computations for processing the database query;

generate native code from the intermediate executable representation, wherein the native code is optimized for execution on the second processing unit, wherein the instructions to generate native code cause the processor to:

identify a conditional branch statement in which the execution of instructions on a first branch takes more units of time than execution of instructions on a second branch of the code; and

introduce one or more dummy instructions in the second branch of code, wherein the number of dummy instructions introduced in the second branch of code is determined so as to cause the execution of the first branch and the second branch to take the same number of units of time for execution;

compile the native code to executable code;

select a target processing unit for executing an operator of the database query based on factors comprising the data processed by the query;

responsive to selection of the second processing unit for executing the operator of the database query execute the compiled executable code using the second processing unit; and

send the result of execution of the query.

20. The computer-implemented system of claim 19 , wherein the instructions when executed, further cause the database system to:

determine an estimate of the size of data processed by the operator of the database query; and

wherein the factors considered for selecting the target processing unit for executing an operator of the database query include the size of the data processed by the operator of the database query.

21. The computer-implemented system of claim 19 , wherein the factors considered for selecting the target processing unit for executing the database query include one or more of a data type of data processed by the operator of the database query, a complexity of the database query, and a current amount of work on each of the first processing unit and the second processing unit.

22. The computer-implemented system of claim 19 , wherein the instructions when executed, further cause the database system to:

responsive to the selection of the first processing unit as the target processing unit for executing the operator of the database query, execute the code of the intermediate executable representation by the database system using the database virtual machine.

23. The computer-implemented system of claim 19 , wherein the instructions when executed, further cause the database system to:

responsive to selecting the second processing unit for executing the query, arranging the data processed by the operator of the database query as equal sized portions of data, the arranging comprising adding padding bytes to a first portion of data to match a size of the first portion of data with a size of the second portion of data.

24. The computer-implemented system of claim 19 , wherein execution of the generated native code requires fewer synchronization operations in the single instruction multiple thread based processing units compared to execution of the instructions of the intermediate executable representation.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 13, 2016
From: MELLMO INC.
To: SAP SE
Reel/Frame 038272/0046 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 18, 2013
From: BECERRA, SANTIAGO; BECERRA, SANTIAGO E.; SCHAEFER, ALEX C.; MCINERNEY, JOHN; CHENG, PATRICK
To: MELLMO INC.
Reel/Frame 030025/0217 →
Continuity (1)
Provisional Application 61762782 · Feb 8, 2013