US 7,457,797 B2
Method and apparatus for associating logical conditions with the re-use of a database query execution strategy
Robert Joseph Bestgen, Dodge Center, Minn. (US); Carol Ledermann Ramler, Rochester, Minn. (US); and Jeffrey Wayne Tenner, Rochester, Minn. (US)
Assigned to International Business Machines Corporation, Armonk, N.Y. (US)
Filed on Mar. 30, 2005, as Appl. No. 11/94,655.
Prior Publication US 2006/0224561 A1, Oct. 05, 2006
Int. Cl. G06F 17/30 (2006.01)
U.S. Cl. 707—2  [707/3; 707/102; 707/100] 12 Claims
OG exemplary drawing
 
1. A method for executing a database query in a computer system, comprising the steps of:
automatically generating a re-usable query execution strategy for a database query, said database query containing at least one condition comparing a first database field to an imported variable value, said re-usable query execution strategy employing a database subset data structure containing data from a subset of records in said database, said subset having a scope defined with reference to said first database field, said re-usable query execution strategy being re-usable for multiple execution invocations of said database query, each execution invocation including a respective instance of said imported variable value;
automatically generating a query execution strategy condition expression associated with said re-usable query execution strategy, said query execution strategy condition expression expressing at least one condition on use of said query execution strategy, said at least one condition limiting said imported variable value to a range of values in which said at least one condition of said query is within a scope of said database subset data structure, wherein said step of automatically generating a query execution strategy condition expression comprises:
negating a predicate referencing said first database field contained in a subset definition expression defining the scope of said database subset data structure, inserting said negated predicate into said at least one condition of said query comparing a first database field to an imported variable value, and performing a transitive closure of the expression resulting from said inserting step,
wherein said database subset data structure comprises data joined from a plurality of database tables;
invoking said database query including a first instance of said imported variable value;
evaluating said query execution strategy condition expression using said first instance of said imported variable value; and
using said query execution strategy to execute said database query including said first instance of said imported variable value depending on results of said evaluating step.