SYSTEM FOR PREFETCHING DATA NECESSARY TO EXECUTE PROGRAM FROM DATABASE

Information

  • Patent Application
  • 20070156646
  • Publication Number
    20070156646
  • Date Filed
    December 07, 2006
    18 years ago
  • Date Published
    July 05, 2007
    17 years ago
Abstract
In order to improve the efficiency of execution of a program by prefetching data necessary to execute the program, a system is provided that causes a computer to execute a recursive query prior to a program being subjected to prefetching. This system detects from iterative processing in the program a query to generate a resultant table by selecting a record that satisfies a selection condition from a target table. The system generates an initial query to generate an initial table that includes values of variables that are set prior to starting the iterative processing in the program. Furthermore, the system generates a recursive query to generate the next intermediate table that is referred to in the next and later cycles of the iterative processing, in the recursive query corresponding to each cycle of the iterative processing that is sequentially performed, from an intermediate table that includes resultant tables generated by a target query in the preceding cycles of the iterative processing and the target table. Furthermore, the system generates a final query to generate a final table from the intermediate table sequentially generated by the recursive query.
Description

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS


FIG. 1 shows the overall structure of an information processing system 10 according to embodiments of the present invention.



FIG. 2 shows a first example of a target program 20 input to an application server 40.



FIG. 3 shows exemplary data in a database 35, the data being necessary to execute the first example of the target program 20.



FIG. 4 shows the functional structure of the application server 40 according to the embodiments of the present invention.



FIG. 5 shows an exemplary process of prefetching necessary data by analyzing the target program 20 in the embodiments of the present invention.



FIG. 6 shows the outline of processing in S510 in FIG. 5.



FIG. 7 shows the outline of processing in S520 in FIG. 5.



FIG. 8 shows template instructions 80, a recursive query 82, which is generated on the basis of the target program 20 according the first example, and an improved query 84 in parallel.



FIG. 9 shows a second example of the target program 20 input to the application server 40.



FIG. 10 shows an example of data, out of the database 35, necessary to execute the second example of the target program 20.



FIG. 11 shows an additional table necessary to analyze the program in the second example.



FIG. 12 shows concrete examples of the recursive query 82 that are generated on the basis of the target program 20 in the second example.



FIG. 13 shows a third example of the target program 20 input to the application server 40.



FIG. 14 is an example of data, out of the database 35, necessary to execute the target program 20 in the third example.



FIG. 15 shows a concrete example of the recursive query 82 generated on the basis of the target program 20 in the first example.



FIG. 16 shows the improved query 84 that is an improved example of the recursive query 82.



FIG. 17 shows an example of the hardware configuration of a computer 900 functioning as the application server 40 according to the embodiments of the present invention.


Claims
  • 1. A system in which a computer generates a recursive query and executes the recursive query, prior to executing a program subjected to prefetching, to prefetch data necessary to execute the program from a database and supply the data to the program, the recursive query including an initial query that generates an initial table, a next recursive query that generates a next intermediate table that satisfies a selection condition from an intermediate table that is one of the initial table and a most recent table that is generated by a most recent recursive query, and a final query that generates and outputs a final table from individual intermediate tables including the next intermediate table.
  • 2-11. (canceled)
  • 12. The system according to claim 1, further comprising: an acquiring unit that acquires the program;an instruction detecting unit that detects a query as a target query subjected to prefetching from iterative processing in the program, the query selecting a record that satisfies a predetermined selection condition from a target table to generate a resultant table;an initial-query generating unit that generates the initial query to generate the initial table that includes values of variables that are set in advance prior to starting iterative processing in the program;a recursive-query generating unit that generates the next recursive query to generate the next intermediate table, in the recursive query corresponding to each of cycles of the iterative processing that are sequentially performed, by selecting columns that are referred to by a next target query in next and later cycles of the iterative processing and a record that satisfies the predetermined selection condition from the target table and the intermediate table that includes resultant tables generated by a preceding target query in the preceding cycles of the iterative processing; anda final-query generating unit that generates the final query to select at least some of columns of the intermediate table sequentially generated by the recursive query.
  • 13. The system according to claim 12, wherein the instruction detecting unit detects as the target query a query to select a record that satisfies the selection condition concerning a key variable specified in the program, further comprising a first-calculation-formula detecting unit that scans the program reversely along an execution path from a first target query that is a target of the iterative processing to a second target query that is a prior target of the iterative processing that is performed prior to the first target query and detects a first calculation formula for calculating a value of the key variable in said first target query using the resultant table of said second target query as an input, andthe recursive-query generating unit generates, as the next recursive query, a query to generate the next intermediate table by selecting a record that satisfies the predetermined selection condition concerning a calculation result using the intermediate table and the target table.
  • 14. The system according to claim 13, wherein the first-calculation-formula detecting unit generates a define-use (D-U) chain regarding the target query, traces back the D-U chain to detect a path from the key variable of the first target query in the iterative processing to the resultant table from the second target query in the iterative processing, and detects calculation that is performed on the path to obtain the value of the key variable from the resultant table as the first calculation formula.
  • 15. The system according to claim 14, wherein the instruction detecting unit detects as the target query a query to generate the resultant table that includes a plurality of records, and the first-calculation-formula detecting unit traces back the D-U chain to detect the path from the key variable to the resultant table by handling other iterative processing, in which the same processing is sequentially performed on the plurality of records, as processing that is performed on any one of the records.
  • 16. The system according to claim 13, wherein the first-calculation-formula detecting unit detects a maximum number of times of “trace-back” of iteration performed from the first query of the iterative processing to the second query of the iterative processing, assuming that each query is said first query, further comprising a number-of-columns setting unit that sets as a number of columns of an intermediate table of the recursive query a number that is obtained by multiplying the number of times of trace-back by the number of columns of a column name list of the target query,the initial-query generating unit generates as the initial query a query to generate an initial table that includes values of variables that are set prior to starting the iterative processing and resultant tables from the target query in individual cycles of the iterative processing performed after a cycle of the iterative processing to which as many cycles of the iterative processing as the number of times of trace-back are traced back,the recursive-query generating unit generates as the recursive query a query to generate the next intermediate table, in each recursive query, by removing the first generated resultant table from an intermediate table that includes resultant tables in individual cycles of iterative processing that range from a corresponding cycle of the iterative processing to a cycle of the iterative processing to which as many cycles of the iterative processing as the number of times of trace-back are traced back, selecting a record that satisfies the selection condition from the target table, and adding the record to the intermediate table, andthe final-query generating unit generates as the final query a query to select a part that is selected in a corresponding recursive query from the target table from the intermediate table that is generated in each recursive query.
  • 17. The system according to claim 12, further comprising a second-calculation-formula detecting unit that scans the program reversely along an execution path from the first target query of the iterative processing to the second target query of the iterative processing that is performed prior to the first query of the iterative processing and detects a second calculation formula for calculating a value of a determining variable that is used to determine to terminate the first query of the iterative processing, with a resultant table from the second target query of the iterative processing being the input, wherein the recursive-query generating unit generates as the recursive query a query to terminate a recursive query on condition that the calculation result of inputting the intermediate table to the second calculation formula satisfies a condition for determining to terminate the recursive query and generate the next intermediate table on condition that the calculation result does not satisfy the condition for determining to terminate the recursive query.
  • 18. The system according to claim 17, wherein the recursive-query generating unit generates the recursive query by adding to the selection condition a condition for continuing the recursive query that the calculation result of inputting the intermediate table to the second calculation formula does not satisfy the condition for determining to terminate the process.
  • 19. The system according to claim 18, wherein the recursive-query generating unit does not add to the selection condition the condition for continuing the recursive query when the calculation result of inputting the intermediate table to the second calculation formula satisfies the condition for determining to terminate the process in a case where no record that satisfies the selection condition exists in the target table.
  • 20. The system according to claim 12, wherein the initial-query generating unit generates as the initial query a query to generate as an initial table a table that further includes a column that stores a value of an external input, and the recursive-query generating unit generates as the recursive query a query to generate as the next intermediate table a table that further includes a column that stores a value of an external input.
  • 21. A method in which a computer generates a recursive query and executes the recursive query, prior to executing a program subjected to prefetching, to prefetch data necessary to execute the program from a database and supply the data to the program, the recursive query including an initial query that generates an initial table, a next recursive query that generates a next intermediate table that satisfies a selection condition from an intermediate table that is one of the initial table and a most recent table that is generated by a most recent recursive query, and a final query that generates and outputs a final table from individual intermediate tables including the next intermediate table.
  • 22. The method of claim 21, further comprising: a step of acquiring the program;a step of detecting a query as a target query subjected to prefetching from iterative processing in the program, the query selecting a record that satisfies a predetermined selection condition from a target table to generate a resultant table;a step of generating the initial query to generate the initial table that includes values of variables that are set in advance prior to starting iterative processing in the program;a step of generating the next recursive query to generate the next intermediate table, in the recursive query corresponding to each of cycles of the iterative processing that are sequentially performed, by selecting columns that are referred to by a next target query in next and later cycles of the iterative processing and a record that satisfies the predetermined selection condition from the target table and an intermediate table that includes resultant tables generated by a preceding target query in the preceding cycles of the iterative processing; anda step of generating the final query to select at least some of columns of the intermediate table sequentially generated by the recursive query.
  • 23. A control program causing a computer to function as a system in which the computer generates a recursive query and executes the recursive query, prior to executing a program subjected to prefetching, to prefetch data necessary to execute the program from a database and supply the data to the program, the recursive query including an initial query that generates an initial table, a next recursive query that generates a next intermediate table that satisfies a selection condition from an intermediate table that is one of the initial table and a most recent table that is generated by a most recent recursive query, and a final query that generates and outputs a final table from individual intermediate tables including the next intermediate table.
  • 24. The control program according to claim 23, further comprising: an acquiring unit that acquires the program;an instruction detecting unit that detects a query as a target query subjected to prefetching from iterative processing in the program, the query selecting a record that satisfies a predetermined selection condition from a target table to generate a resultant table;an initial-query generating unit that generates the initial query to generate the initial table that includes values of variables that are set in advance prior to starting iterative processing in the program;a recursive-query generating unit that generates the next recursive query to generate the next intermediate table, in the recursive query corresponding to each of cycles of the iterative processing that are sequentially performed, by selecting columns that are referred to by a next target query in next and later cycles of the iterative processing and a record that satisfies the predetermined selection condition from the target table and an intermediate table that includes resultant tables generated by a preceding target query in the preceding cycles of the iterative processing; anda final-query generating unit that generates the final query to select at least some of columns of the intermediate table sequentially generated by the recursive query.
Priority Claims (1)
Number Date Country Kind
2005-374821 Dec 2005 JP national