US 7,321,888 B2 | ||
Method and system for dynamic join reordering | ||
Paul Reuben Day, Rochester, Minn. (US); and Brian Robert Muras, Rochester, Minn. (US) | ||
Assigned to International Business Machines Corporation, Armonk, N.Y. (US) | ||
Filed on Sep. 11, 2003, as Appl. No. 10/660,166. | ||
Prior Publication US 2005/0060292 A1, Mar. 17, 2005 | ||
Int. Cl. G06F 17/30 (2006.01) |
U.S. Cl. 707—2 [707/3; 707/5; 707/100; 707/104.1] | 8 Claims |
1. A computer-implemented method for monitoring a query during runtime, said query involving a plurality of join operations,
the method comprising the steps of:
wherein the plurality of join operations include a first join that includes a first table and a second table and a second
join that includes the first table and a third table;
running the query according to a first join order;
generating a first portion of a result set for the query while running the query according to the first join order, including
adding to the result set a first record that matches the plurality of join operations in the query;
concurrent with running the query, collecting performance statistics about each of the join operations;
dynamically changing the first join order, during running of the query, to a second join order based on the statistics;
where said dynamically changing the first join order, during running of the query, to a second join order based on the statistics
comprises:
determining respective fan-in statistics for the first join and second join; and
dynamically changing the first join order to the second join order if the respective fan-in statistics indicate that the second
join is more likely to cause fan-in than the first join; and
generating a second portion of the result set for the query while running the query according to the second join order, including
adding to the result set a second record that matches the plurality of join operations in the query such that the result set
includes at least the first and second records, the first and second portions of the result set generated for the same execution
of the query.
|