IP Library Granted Patent US 9,213,732
Granted Patent B2
US 9,213,732 · App. 13/729,111 · Granted Dec 15, 2015

Hash table and radix sort based aggregation

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,213,732
App. No.
13/729,111
Granted
Dec 15, 2015
Kind
B2
Abstract

Aggregation of an in-memory database includes receiving, by at least one processor having a plurality of threads, input having records stored in random access memory, distributing, by the at least one processor, the input into portions, one of the plurality of threads having an assigned portion, aggregating, by the at least one processor, the records in the assigned portion based on locality of keys in the records and outputting, by the at least one processor, the aggregated records into a global hash table.

Claims (49)

1. A method, comprising:

receiving, by at least one processor having a plurality of threads, a query comprising an aggregation operation that aggregates a plurality of records across a plurality of columns stored in random access memory;

distributing, by the at least one processor, a portion of the records to each of the plurality of threads for aggregation;

determining an aggregation threshold based on a ratio of a number of records stored in an intermediate private hash table to a size of the intermediate private hash table;

aggregating in accordance with the aggregation operation, by a first thread of the plurality of threads, the portion of records distributed to the first thread into a result stored in one or more hash tables associated with the first thread,

wherein if a locality of keys is greater than the aggregation threshold, the aggregating uses multiple private hash tables, and

wherein if the locality of keys is less than or equal to the aggregation threshold, the aggregating uses a radix-sort based aggregation; and

outputting, by the first thread, the result into a global hash table asynchronously with respect to any other threads of the plurality of threads.

2. The method of claim 1 , wherein the aggregating comprises:

aggregating the records in the assigned portion using both multiple private hash tables and radix-sort buckets.

3. The method of claim 1 , further comprising:

performing the aggregating in a number of passes proportional to log(k) where k is equal to a number of distinct keys found in the records.

4. The method of claim 3 , further comprising:

determining log(k) bits of a hash of each of the distinct keys found in the records.

5. The method of claim 1 , wherein the aggregation operation comprises determining an average of at least a subset of the records.

6. The method of claim 1 , wherein the aggregating comprises:

aggregating, by each thread, its portion of records one column at a time.

7. The method of claim 1 , wherein each thread outputs its result to a distinct location in the global hash table.

8. A system, comprising:

random access memory configured to store a database; and

at least one processor having a plurality of threads configured to:

receive, by at least one processor having a plurality of threads, a query comprising an aggregation operation that aggregates a plurality of records across a plurality of columns stored in random access memory;

distribute, by the at least one processor, a portion of the records to each of the plurality of threads for aggregation;

determine an aggregation threshold based on a ratio of a number of records stored in an intermediate private hash table to a size of the intermediate private hash table;

aggregate in accordance with the aggregation operation, by a first thread of the plurality of threads, the portion of records distributed to the first thread into a result stored in one or more hash tables associated with the first thread,

wherein if a locality of keys is greater than the aggregation threshold, the aggregating uses multiple private hash tables, and

wherein if the locality of keys is less than or equal to the aggregation threshold, the aggregating uses a radix-sort based aggregation; and

output, by the first thread, the result into a global hash table asynchronously with respect to any other threads of the plurality of threads.

9. The system of claim 8 , wherein the at least one processor is configured to:

aggregate the records in the assigned portion using both multiple private hash tables and radix-sort buckets.

10. The system of claim 8 , wherein the at least one processor is configured to:

aggregate in a number of passes proportional to log(k) where k is equal to a number of distinct keys found in the records.

11. The system of claim 8 , wherein the at least one processor is further configured to:

determine log(k) bits of a hash of each of the distinct keys found in the records.

12. A computer-readable device having instructions stored thereon, execution of which, by at least one computing device, causes the at least one computing device to perform operations comprising:

receiving, by at least one processor having a plurality of threads, a query comprising an aggregation operation that aggregates a plurality of records across a plurality of columns stored in random access memory;

distributing, by the at least one processor, a portion of the records to each of the plurality of threads for aggregation;

determining an aggregation threshold based on a ratio of a number of records stored in an intermediate private hash table to a size of the intermediate private hash table;

aggregating in accordance with the aggregation operation, by a first thread of the plurality of threads, the portion of records distributed to the first thread into a result stored in one or more hash tables associated with the first thread,

wherein if a locality of keys is greater than the aggregation threshold, the aggregating uses multiple private hash tables, and

wherein if the locality of keys is less than or equal to the aggregation threshold, the aggregating uses a radix-sort based aggregation; and

outputting, by the first thread, the result into a global hash table asynchronously with respect to any other threads of the plurality of threads.

13. A method, comprising:

receiving, by at least one processor having a plurality of threads, a query comprising an aggregation operation that aggregates a plurality of records across a plurality of columns stored in random access memory;

distributing, by the at least one processor, a portion of the records to each of the plurality of threads for aggregation;

aggregating in accordance with the aggregation operation, by a first thread of the plurality of threads, the portion of records distributed to the first thread into a result stored in one or more hash tables associated with the first;

determining, by the at least one processor, an aggregation threshold equal to s′ / s, where s′ is equal to a number of records stored in an intermediate private hash table and s is equal to a size of the intermediate private hash table;

performing, by the at least one processor, the aggregating in a number of passes proportional to log(k) where k is equal to a number of distinct keys found in the records, by aggregating the records in the assigned portion using intermediate private hash tables if the locality of keys is greater than the aggregation threshold or using radix-sort based aggregation if the locality of keys is less than or equal to the aggregation threshold; and

outputting, by the first thread, the result into a global hash table asynchronously with respect to any other threads of the plurality of threads.

Assignments (2)
CHANGE OF NAME Recorded Aug 26, 2014
From: SAP AG
To: SAP SE
Reel/Frame 033625/0223 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 20, 2013
From: MULLER, INGO TOBIAS; SANDERS, PETER
To: SAP AG
Reel/Frame 031827/0723 →