Patent ID: 8832157

Claim:
A method for counting a number of distinct values in multiple columns of a database table, the method comprising the steps of: associating a portion of the database table with each one of a plurality of processing modules; at each one of the plurality of processing modules, performing a local aggregation function to count occurrences of distinct values in each one of the multiple columns of the associated portion of the database table; creating a local aggregation cache corresponding to each one of the columns of the database table; and saving the count of occurrences of the distinct values in each one of the columns to the corresponding local aggregation cache; creating a plurality of global aggregation caches, wherein each global aggregation cache corresponds to one of the columns of the database table; and assigning one of the multiple columns to a corresponding one of the plurality of processing modules; and at each of the plurality of processing modules: receiving the count of occurrences from the local aggregation cache corresponding to the assigned one of the multiple columns of the database table; and merging the count of occurrences for each one of the assigned columns from the local aggregation caches into the corresponding global aggregation cache; and determining the total count of the number of occurrences of the distinct values in the multiple columns of the database table based on the global aggregation caches.