Server side bucketization of parameterized queries
First Claim
1. A computer-implemented method, comprising:
- receiving, from a requesting object, at least one parameterized query expression of a structured query language (SQL);
generating at least one new parameterized query expression based on the at least one received parameterized query expression, wherein the generating includes replacing a type of at least one parameter of the at least one parameterized query expression with a new normalized parameter type, wherein the replacing is executed, according to at least one pre-defined conversion algorithm, the at least one parameter being associated with first metadata to be returned by a query;
determining for the at least one parameter, whether said replacing the type of the at least one parameter will;
change semantic information of the at least one parameterized query expression; and
cause second metadata to be returned by the query, wherein the first metadata to be returned by the query is different from the second metadata to be returned by the query;
performing said replacing the type of the at least one parameter based, at least, on the determining for the at least one parameter that;
said semantic information of the at least one parameterized query expression will remain unchanged; and
the first metadata to be returned by the query is the same as the second metadata to be returned by the query; and
identifying whether literals of a non-parameterized query statement are parameterizable to a parameterized query expression by;
determining whether replacing the literals with a parameter will not change data or metadata transmitted back to a client; and
identifying as literals that are parameterizable to the parameterized query expression, ones of the literals for which the replacing will not change data or metadata transmitted back to the client;
wherein the type of the at least one parameter has a length in a range from 1 to n and the new normalized parameter type has a length equal to n, wherein said n is at least one of an integer or a real number.
2 Assignments
0 Petitions
Accused Products
Abstract
Efficient server-side query statement parameter bucketization is provided for a query language, such as the structured query language (SQL). A process is applied for replacing the parameters of a parameterized query with new parameters, whose types are normalized to enable more query execution plan sharing. In one embodiment, in response to receiving a parameterized query expression of a query language, the bucketization process operates to bucketize parameter(s) of the parameterized expression based on the type(s) of the parameter(s) by replacing the type(s) with new broader, or more specific, type(s). An existing server-side parameterization framework that includes a mechanism for determining when parameterization is “safe,” is extended, and is applied to bucketize parameters by using the mechanism to determine when replacing a parameter(s) of parameterized expressions with new parameter(s) of different type(s) is safe.
-
Citations
13 Claims
-
1. A computer-implemented method, comprising:
-
receiving, from a requesting object, at least one parameterized query expression of a structured query language (SQL); generating at least one new parameterized query expression based on the at least one received parameterized query expression, wherein the generating includes replacing a type of at least one parameter of the at least one parameterized query expression with a new normalized parameter type, wherein the replacing is executed, according to at least one pre-defined conversion algorithm, the at least one parameter being associated with first metadata to be returned by a query; determining for the at least one parameter, whether said replacing the type of the at least one parameter will; change semantic information of the at least one parameterized query expression; and cause second metadata to be returned by the query, wherein the first metadata to be returned by the query is different from the second metadata to be returned by the query; performing said replacing the type of the at least one parameter based, at least, on the determining for the at least one parameter that; said semantic information of the at least one parameterized query expression will remain unchanged; and the first metadata to be returned by the query is the same as the second metadata to be returned by the query; and identifying whether literals of a non-parameterized query statement are parameterizable to a parameterized query expression by; determining whether replacing the literals with a parameter will not change data or metadata transmitted back to a client; and identifying as literals that are parameterizable to the parameterized query expression, ones of the literals for which the replacing will not change data or metadata transmitted back to the client; wherein the type of the at least one parameter has a length in a range from 1 to n and the new normalized parameter type has a length equal to n, wherein said n is at least one of an integer or a real number. - View Dependent Claims (2, 3, 4, 12, 13)
-
-
5. A database server-side system configured to maintain and update a data store, the database server-side system comprising:
-
a processor; and a computer-readable storage medium storing instructions that, when executed by the processor, cause the processor to implement at least one of a parameter type bucketization logic component or a query optimizer component, said instructions executable for; the parameter type bucketization logic component configured to receive at least one parameterized query expression of a structured query language (SQL) and generate at least one new parameterized query expression based on the at least one parameterized query expression, wherein the at least one parameterized expression includes a parameter type associated with first metadata to be returned by a query, and wherein a generated at least one new parameterized query expression includes a parameter type associated with a second metadata to be returned by the query, wherein the parameter type bucketization logic component includes an extension to a server-side parameterization framework of the structured query language (SQL) server and is configured to; determine whether, based on the at least one new parameterized query expression; semantic information of the at least one parameterized query expression will change; and the second metadata to be returned by the query will be different from the first metadata to be returned by the query; and generate the at least one new parameterized query expression based, at least, on a determination that the semantic information will not change and the second metadata will be the same as the first metadata; a query optimizer component configured to receive the at least one new parameterized query expression and generate an optimized query plan according to the at least one new parameterized query expression, wherein the extension is configured to employ a mechanism of the server-side parameterization framework, wherein the mechanism is configured to identify whether literals of a non-parameterized query statement are parameterizable to a parameterized query expression by; determining whether replacing the literals with a parameter will not change data or metadata transmitted back to a client; and identifying as literals that are parameterizable to the parameterized query expression, ones of the literals for which the replacing will not change data or metadata transmitted back to the client, wherein said parameter type bucketization logic component is configured to convert the parameter type having a length between 1 and n to a new type having a length equal to n, wherein said n is at least one of an integer or a real number. - View Dependent Claims (6, 7, 8, 9, 10)
-
-
11. A computer-implemented method comprising:
-
receiving, by a database server-side object, a first parameterized query expression of a structured query language (SQL), wherein the first parameterized query expression includes at least one literal including a first parameter type; transforming the first parameterized query expression to a first bucketized query expression according to a transformation process that changes the first parameter type to a new normalized parameter type, wherein the first parameter type is associated with first metadata to be returned by a query, and wherein the new normalized parameter type is associated with second metadata to be returned by the query, and wherein the transforming is performed based, at least, on determining that the second metadata would be the same as the first metadata; generating a query execution plan based on the first bucketized query expression; receiving, by the database server-side object, a second parameterized query expression of the query language, wherein the second parameterized query expression includes at least one literal including a second parameter type, wherein the second parameter type is different than the first parameter type; transforming the second parameterized query expression to a second bucketized query expression according to the transformation process, whereby the transformation process changes the second parameter type to said new normalized parameter type, wherein the second parameter type is associated with third metadata to be returned by a query, and wherein the transforming is performed based, at least, on determining that the third metadata would be the same as the first metadata; accessing said query execution plan generated based on the first bucketized query expression based, at least, on executing said second bucketized query expression; identifying whether literals of a non-parameterized query statement are parameterizable to a parameterized query expression by; determining whether replacing the literals with a parameter will not change data or metadata transmitted back to a client; and identifying as literals that are parameterizable to the parameterized query expression, ones of the literals for which the replacing will not change data or metadata transmitted back to the client; wherein the first parameter type and the second parameter type have a length in a range from 1 to n and the new normalized parameter type has a length equal to n, wherein said n is at least one of an integer or a real number.
-
Specification