Patent ID: 7565342

Claim:
A computer-implemented method for processing a query including semi-joins, comprising: at execution time, for each of multiple rounds of semi-join executions, during a current round of semi-join executions, until each semi-join to be processed in the current round has been processed: under control of a runtime execution processor, selecting a semi-join from the semi-joins for execution in the current round of semi-join executions that has not already been processed in the current round, has not been terminated in a previous round, and is not temporarily suspended for the current round, wherein an ordering of the semi-joins is based on heuristic rules that involve statistics generated from each semi-join execution; and determining a reporting threshold that indicates a number of record-identifiers to be retrieved for the selected semi-join before processing of the semi-join is stopped for the current round of semi-join executions; and under control of a pair-wise join runtime processor, executing the selected semi-join until the determined number of record identifiers are retrieved; and returning control to the runtime execution processor; and in response to determining that each of the semi-joins to be processed has been processed in the current round, terminating any semi-joins that have not been completely executed and are poorly selective, wherein the poorly selective semi-joins are ones that retrieve a high percentage of the total record-identifiers; and suspending any semi-joins for processing in a next round before beginning the next round of semi-join executions based on whether the semi-joins are expected to retrieve a large number of record-identifiers.