CPC G06F 16/2255 (2019.01) [G06F 16/2237 (2019.01); G06F 16/24542 (2019.01); G06F 16/2455 (2019.01); G06F 16/24552 (2019.01); G06F 16/2456 (2019.01); G06F 16/24561 (2019.01)] | 20 Claims |
1. A computer-implemented method for processing database queries using multimaps, the method comprising:
receiving, by a database system, a database query for processing data stored in a database table;
receiving a set of records based on the database table processed by the database query;
allocating a multimap, wherein the multimap is a data structure that maps keys to data values such that a single key can be mapped to one or more data values, the multimap configured to store tuples, each tuple comprising a first element and a second element, the first element of the tuple storing a key, and the second element of the tuple storing a data value or a pointer that points to a vector that contains a plurality of data values;
identifying from the set of records, a first record associated with a particular key and a first data value;
responsive to determining that there are no data values stored in the multimap for the particular key, storing in a tuple in the multimap, the particular key as the first element and the first data value as the second element;
identifying from the set of records, a second record associated with the particular key and a second data value;
responsive to determining that the multimap stores the tuple having the particular key as the first element and the first data value as the second element different from the second data value:
allocating a vector,
storing the first data value and the second data value in the vector,
identifying a pointer of the vector, and
replacing the first data value stored in the second element with the pointer of the vector; and
processing the database query based on the multimap.
|