Generating a producer-driven execution plan from a consumer-driven iterator-based execution plan
AssigneeSybase, Inc.
InventorsXiaobin Ma, Xun Cheng, Prabhas Kumar Samanta
Life of this patent
Estimating the term…
Abstract
An original query execution plan of a database query is received. The original query execution plan represents a tree of operators. Source code for the original query execution plan is generated by a single traversal of the tree of operators. The generated source code is compiled into native machine code. The native machine code represents a simplified native access plan (SNAP).
Claims20
A computer implemented method to generate a simplified native access plan (SNAP) from an original query execution plan, the method comprising:
- receiving an original query execution plan of a database query of a database system, wherein the original query execution plan represents a tree of operators;
- determining whether the database system is configured to permit processing of the SNAP;
- wherein in response to determining that the database system is configured to permit the processing of the SNAP,
- at runtime, generating source code for the original query execution plan by a single traversal of the tree of operators;
- during generating the source code, converting a nested loop join in the original query execution plan from an iterator-based model to a single function consisting of a doubled loop;
- including in the doubled loop a function to send a respective row to a client process after the doubled loop generates each respective row;
- the single traversal traversing the tree of operators beginning at a root node and generating the source code from a bottom of the tree of operators upward;
- and
- at runtime, compiling the generated source code into native machine code, wherein the native machine code represents the SNAP.
A computer system configured to generate a simplified native access plan from an original query execution plan (SNAP), the computer system including:
- a memory to store computer executable instructions;
- at least one computer processor coupled to the memory to execute the instructions, to perform operations comprising:
- receiving an original query execution plan of a database query of a database system, wherein the original query execution plan represents a tree of operators;
- determining whether the database system is configured to permit processing of the SNAP;
- wherein in response to determining that the database system is configured to permit the processing of the SNAP,
- at runtime, generating source code for the original query execution plan by a single traversal of the tree of operators;
- during generating the source code, converting a nested loop join in the original query execution plan from an iterator-based model to a single function consisting of a doubled loop;
- including in the doubled loop a function to send a respective row to a client process after the doubled loop generates each respective row;
- the single traversal traversing the tree of operators beginning at a root node and generating the source code from a bottom of the tree of operators upward;
- and
- at runtime, compiling the generated source code into native machine code, wherein the native machine code represents the SNAP.
A non-transitory computer readable medium storing instructions thereon, which when executed by a processor cause a computer system to:
- receive an original query execution plan of a database query of a database system, wherein the original query execution plan represents a tree of operators;
- determine whether the database system is configured to permit processing of a simplified native access plan (SNAP);
- wherein in response to determining that the database system is configured to permit the processing of the SNAP,
- at runtime, generate source code for the original query execution plan by a single traversal of the tree of operators;
- during generating the source code, convert a nested loop join in the original query execution plan from an iterator-based model to a single function consisting of a doubled loop;
- including in the doubled loop a function to send a respective row to a client process after the doubled loop generates each respective row;
- the single traversal traversing the tree of operators beginning at a root node and generating the source code from a bottom of the tree of operators upward;
- and
- at runtime, compile the generated source code into native machine code, the native machine code represents a SNAP.
Dependencies are inferred from the claim text.