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.