Patent ID: 8832074

Claim:
A method that facilitates skew avoidance when processing a query by a plurality of processing modules, comprising: receiving, by the plurality of processing modules, the query to be processed, wherein each of the plurality of processing modules has a respective subset of rows of a table on which the query is applied allocated thereto; processing the query, by the plurality of processing modules, a predefined percentage of the respective subset of rows allocated thereto; upon completion of processing of the predefined percentage of the respective subset of rows associated with the query, calculating a selectivity that specifies an amount of the predefined percentage of the respective rows that satisfy the query; calculating based on the calculated selectivity of the respective rows that satisfy the query, a target number of rows that specifies a maximum number of rows to be redistributed to each of the plurality of processing modules; upon completion of processing each of the respective subset of rows, determining if any of the plurality of processing modules has received a number of rows of the table that exceeds the target number of rows; responsive to completing processing of all rows of the table, evaluating each of the plurality of processing modules to respectively determine if each processing module is overloaded or underloaded with respect to the number of rows that satisfy the query respectively maintained by the processing modules; and redistributing rows from any processing module identified as overloaded to at least one processing module identified as underloaded such that each of the plurality of processing modules has a number of rows that does not exceed the target number of rows.