System and method for caching and parameterizing IR
First Claim
Patent Images
1. A method comprising:
- receiving, by a database, a first query;
parsing, by the database, the first query to obtain a plan tree comprising a plurality of plan nodes arranged in hierarchical order descending from a top plan node;
generating, by the database, first node intermediate representations (IRs) for the plan nodes;
parameterizing, by the database, the first node IRs to replace one or more constants or tuple attributes in bodies of the first node IRs each with a respective parameter;
combining, by the database, the parameterized first node IRs to obtain a first module for the first query;
executing, by the database, the first query using the first module;
receiving, by the database, a second query;
generating, by the database, second node IRs for the second query;
parameterizing, by the database, the second node IRs to replace one or more constants or tuple attributes in bodies of the second node IRs each with a respective parameter;
matching, by the database, one or more of the parameterized first node IRs each with a corresponding one of the parameterized second node IRs, the matching parameterized first node IRs differing from the corresponding parameterized second node IRs in the respective parameters for each;
reusing, by the database, the parameterized first node IRs to obtain a second module for the second query, the second module being compiled from the matching parameterized first node IRs and unmatched parameterized second node IRs; and
executing, by the database, the second query using the second module.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and method of caching and parameterizing intermediate representation code includes receiving, by a database, a query, parsing, by the database, the query to obtain a plan tree comprising a plurality of plan nodes arranged in hierarchical order descending from a top plan node, generating, by the database, node intermediate representations (IRs) for the plan nodes, executing, by the database, a first query using the node IRs, and reusing, by the database, the node IRs to execute subsequent queries.
-
Citations
19 Claims
-
1. A method comprising:
-
receiving, by a database, a first query; parsing, by the database, the first query to obtain a plan tree comprising a plurality of plan nodes arranged in hierarchical order descending from a top plan node; generating, by the database, first node intermediate representations (IRs) for the plan nodes; parameterizing, by the database, the first node IRs to replace one or more constants or tuple attributes in bodies of the first node IRs each with a respective parameter; combining, by the database, the parameterized first node IRs to obtain a first module for the first query; executing, by the database, the first query using the first module; receiving, by the database, a second query; generating, by the database, second node IRs for the second query; parameterizing, by the database, the second node IRs to replace one or more constants or tuple attributes in bodies of the second node IRs each with a respective parameter; matching, by the database, one or more of the parameterized first node IRs each with a corresponding one of the parameterized second node IRs, the matching parameterized first node IRs differing from the corresponding parameterized second node IRs in the respective parameters for each; reusing, by the database, the parameterized first node IRs to obtain a second module for the second query, the second module being compiled from the matching parameterized first node IRs and unmatched parameterized second node IRs; and executing, by the database, the second query using the second module. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A method comprising:
-
receiving, by a database, a first query; parsing, by the database, the first query to obtain a first plan tree comprising a first plurality of plan nodes; generating, by the database, first node intermediate representations (IRs) for the first plurality of plan nodes; parameterizing, by the database, the first node IRs to produce first parameterized IRs, the parameterizing comprising replacing one or more constants or tuple attributes in bodies of the first node IRs with corresponding parameters; combining, by the database, the first parameterized IRs to produce a first module; storing, by the database, the first module, the first parameterized IRs, and the first plan tree in a plan cache; executing, by the database, the first query with the first module; receiving, by the database, a second query; parsing the second query to obtain a second plan tree comprising a second plurality of plan nodes, the second plurality of plan nodes being different from the first plurality of plan nodes; generating, by the database, second node IRs for the second plurality of plan nodes; parameterizing, by the database, the second node IRs to produce second parameterized IRs; locating, by the database, matching ones of the first parameterized IRs for the second parameterized IRs, the matching ones of the first parameterized IRs differing from corresponding ones of the second parameterized IRs by the corresponding parameters; combining, by the database, the matching ones of the first parameterized IRs and unmatched ones of the second parameterized IRs to produce a second module; and executing, by the database, the second query using the second module. - View Dependent Claims (7, 8, 9, 10, 11, 12, 13)
-
-
14. A device comprising:
-
a processor; and a computer-readable storage medium storing a program to be executed by the processor, the program including instructions for; receiving a first query; parsing the first query to obtain a plan tree comprising a plurality of plan nodes arranged in hierarchical order descending from a top plan node; generating first node intermediate representations (IRs) for the plan nodes; parameterizing the first node IRs to replace one or more constants or tuple attributes in bodies of the first node IRs each with a respective parameter; combining the parameterized first node IRs to obtain a first module for the first query; executing the first query using the first module; receiving a second query; generating second node IRs for the second query; parameterizing the second node IRs to replace one or more constants or tuple attributes in bodies of the second node IRs each with a respective parameter; matching one or more of the parameterized first node IRs each with a corresponding one of the parameterized second node IRs, the matching parameterized first node IRs differing from the corresponding parameterized second node IRs in the respective parameters for each; reusing the parameterized first node IRs to obtain a second module for the second query, the second module being compiled from the matching parameterized first node IRs and unmatched parameterized second node IRs; and executing the second query using the second module. - View Dependent Claims (15)
-
-
16. A device comprising:
-
a processor; and a computer-readable storage medium storing a program to be executed by the processor, the program including instructions for; receiving a first query; parsing the first query to obtain a first plan tree comprising a first plurality of plan nodes; generating first node intermediate representations (IRs) for the first plurality of plan nodes; parameterizing the first node IRs to produce first parameterized IRs, the parameterizing comprising replacing one or more constants or tuple attributes in bodies of the first node IRs with corresponding parameters; combining the first parameterized IRs to produce a first module; storing the first module, the first parameterized IRs, and the first plan tree in a plan cache; executing the first query with the first module; receiving a second query; parsing the second query to obtain a second plan tree comprising a second plurality of plan nodes, the second plurality of plan nodes being different from the first plurality of plan nodes; generating second node IRs for the second plurality of plan nodes; parameterizing the second node IRs to produce second parameterized IRs; locating matching ones of the first parameterized IRs for the second parameterized IRs, the matching ones of the first parameterized IRs differing from corresponding ones of the second parameterized IRs by the corresponding parameters; combining the matching ones of the first parameterized IRs and unmatched ones of the second parameterized IRs to produce a second module; and executing the second query with the second module. - View Dependent Claims (17, 18, 19)
-
Specification