IP Library Granted Patent US 12,541,495
Granted Patent B2
US 12,541,495 · App. 18/310,459 · Granted Feb 3, 2026

Storage efficient multimaps for processing database queries

Inventors: Adam Szymański (Warsaw, PL); Grzegorz Dudek (Warsaw, PL)
Assignee: Redpanda Data, Inc.
G06F16/2255G06F16/2237G06F16/24542G06F16/2455G06F16/24552G06F16/2456G06F16/24561
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 12,541,495
App. No.
18/310,459
Granted
Feb 3, 2026
Kind
B2
Abstract

A database system uses a hash table for processing database queries. The system stores keys mapped to data values in the hash table. For processing a set of records using the hash table, the system partially sorts the records to match the order of keys of the hash table. The partial storing of the records results in improving the performance of a cache storing the hash table. The hash table may be a multimap that maps a key to multiple data values. The system stores data values mapped to a key in a vector that stores all data values mapped to the key in contiguous memory. The system stores a pointer to the vector in association with the key in the multimap. The system optimizes the multimap to store the data value instead of the pointer if there is a single data value associated with a key.

Claims (89)

1 . A computer-implemented method for executing database queries using a multimap, wherein the multimap is a data structure that stores one or more key pointer pairs, each of the one or more key-pointer pair includes key associated with a pointer that points to a vector, the vector includes a plurality of elements, at least one of the plurality of elements stores a data value associated with the key, and at least one of the plurality of elements stores a size value representing a number of data values stored in the vector, the computer-implemented method comprising:

receiving, by a database system, a database query for processing data stored in one or more database tables;

receiving a first set of records based on the one or more database tables;

repeating for each record of the first set of records:

determining a key and a data value corresponding to the record,

identifying a vector mapped to the key,

adding the data value to the vector, wherein the data value is stored in a next available contiguous memory location after a previously stored data value in the vector,

updating a size value representing a number of data values stored in the vector based on the adding of the data value, and

storing in the multimap a pointer to the vector in association with the key, wherein the pointer references a memory location of the vector that stores the size value;

receiving a second set of records based on the one or more database tables;

repeating for each record of the second set of records:

determining a key corresponding to the record,

accessing a pointer corresponding to the key from the multimap,

accessing data values stored in a vector pointed at by the pointer, and

determining one or more result values based on the data values accessed; and

sending a result of processing the database query based on result values determined using the multimap.

2 . The computer-implemented method of claim 1 , wherein the size value representing the number of data values is stored in the vector as an element adjacent to a last data value stored in the vector.

3 . The computer-implemented method of claim 1 , further comprising:

determining that the vector is full based on the size value;

allocating a new vector that is larger than the vector; and

copying the data values of the vector to the new vector.

4 . The computer-implemented method of claim 3 , wherein each vector stores a number of elements that is a power of two, wherein determining that the vector is full comprises comparing the size value with a power of two.

5 . The computer-implemented method of claim 1 , wherein accessing data values stored in a vector comprises:

accessing a size value pointed at by the pointer corresponding to the key; and

determining a location of a first data value based on the size value.

6 . The computer-implemented method of claim 5 , wherein determining the location of the first data value based on the size value comprises:

determining a number of words used to store data values of the vector based on the size value stored in the vector; and

determining the location of the first data value based on the number of words to store data values of the vector and the value stored in the pointer associated with the key.

7 . The computer-implemented method of claim 5 , wherein the database query specifies a join operation of a first database table and a second database table, wherein the first set of records is obtained from the first database table and the second set of records is obtained from the second database table.

8 . A non-transitory computer readable storage medium storing instructions that when processed by a computer processor cause the computer processor to perform steps for executing database queries using a multimap, wherein the multimap is a data structure that stores one or more key-pointer pairs, each of the one or more key-pointer pair includes key associated with a pointer that points to a vector, the vector includes a plurality of elements, at least one of the plurality of elements stores a data value associated with the key, and at least one of the plurality of elements stores a size value representing a number of data values stored in the vector, the steps comprising:

receiving, by a database system, a database query for processing data stored in one or more database tables;

receiving a first set of records based on the one or more database tables;

repeating for each record of the first set of records:

determining a key and a data value corresponding to the record,

identifying a vector mapped to the key,

adding the data value to the vector, wherein the data value is stored in a next available contiguous memory location after a previously stored data value in the vector,

updating a size value representing a number of data values stored in the vector based on the adding of the data value, and

storing in the multimap a pointer to the vector in association with the key, wherein the pointer references a memory location of the vector that stores the size value;

receiving a second set of records based on the one or more database tables;

repeating for each record of the second set of records:

determining a key corresponding to the record,

accessing a pointer corresponding to the key from the multimap,

accessing data values stored in a vector pointed at by the pointer, and

determining one or more result values based on the data values accessed; and

sending a result of processing the database query based on result values determined using the multimap.

9 . The non-transitory computer readable storage medium of claim 8 , wherein the size value representing the number of data values is stored in the vector as an element adjacent to a last data value stored in the vector.

10 . The non-transitory computer readable storage medium of claim 8 , wherein the instructions further cause the computer processor to perform steps comprising:

determining that the vector is full based on the size value;

allocating a new vector that is larger than the vector; and

copying the data values of the vector to the new vector.

11 . The non-transitory computer readable storage medium of claim 10 , wherein each vector stores a number of elements that is a power of two, wherein determining that the vector is full comprises comparing the size value with a power of two.

12 . The non-transitory computer readable storage medium of claim 8 , wherein accessing data values stored in a vector comprises:

accessing a size value pointed at by the pointer corresponding to the key; and

determining a location of a first data value based on the size value.

13 . The non-transitory computer readable storage medium of claim 12 , wherein determining the location of the first data value based on the size value comprises:

determining a number of words used to store data values of the vector based on the size value stored in the vector; and

determining the location of the first data value based on the number of words to store data values of the vector and the value stored in the pointer associated with the key.

14 . The non-transitory computer readable storage medium of claim 12 , wherein the database query specifies a join operation of a first database table and a second database table, wherein the first set of records is obtained from the first database table and the second set of records is obtained from the second database table.

15 . A computer system comprising:

a computer processor; and

a non-transitory computer readable storage medium storing instructions that when processed by a computer processor cause the computer processor to perform steps for executing database queries using a multimap, wherein the multimap is a data structure that stores one or more key-pointer pairs, each of the one or more key-pointer pair includes key associated with a pointer that points to a vector, the vector includes a plurality of elements, at least one of the plurality of elements stores a data value associated with the key, and at least one of the plurality of elements stores a size value representing a number of data values stored in the vector, the steps comprising:

receiving, by a database system, a database query for processing data stored in one or more database tables;

receiving a first set of records based on the one or more database tables;

repeating for each record of the first set of records:

determining a key and a data value corresponding to the record,

identifying a vector mapped to the key,

adding the data value to the vector, wherein the data value is stored in a next available contiguous memory location after a previously stored data value in the vector,

updating a size value representing a number of data values stored in the vector based on the adding of the data value, and

storing in the multimap a pointer to the vector in association with the key,

wherein the pointer references a memory location of the vector that stores the size value;

receiving a second set of records based on the one or more database tables;

repeating for each record of the second set of records:

determining a key corresponding to the record,

accessing a pointer corresponding to the key from the multimap,

accessing data values stored in a vector pointed at by the pointer, and

determining one or more result values based on the data values accessed; and

sending a result of processing the database query based on result values determined using the multimap.

16 . The computer system of claim 15 , wherein the size value representing the number of data values is stored in the vector as an element adjacent to a last data value stored in the vector.

17 . The computer system of claim 15 , wherein the instructions further cause the computer processor to perform steps comprising:

determining that the vector is full based on the size value;

allocating a new vector that is larger than the vector; and

copying the data values of the vector to the new vector.

18 . The computer system of claim 17 , wherein each vector stores a number of elements that is a power of two, wherein determining that the vector is full comprises comparing the size value with a power of two.

19 . The computer system of claim 15 , wherein accessing data values stored in a vector comprises:

accessing a size value pointed at by the pointer corresponding to the key; and

determining a location of a first data value based on the size value.

20 . The computer system of claim 19 , wherein determining the location of the first data value based on the size value comprises:

determining a number of words used to store data values of the vector based on the size value stored in the vector; and

determining the location of the first data value based on the number of words to store data values of the vector and the value stored in the pointer associated with the key.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 15, 2025
From: OXLA SP. Z O.O
To: REDPANDA DATA, INC.
Reel/Frame 073213/0277 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 29, 2023
From: SZYMANSKI, ADAM; DUDEK, GRZEGORZ
To: OXLA SP. Z O.O.
Reel/Frame 065068/0762 →
Priority Claims (1)
PL 443718 · Feb 8, 2023 · national
Continuity (1)
Related Publication 20240264994A1 · Aug 8, 2024
References Cited (36)
US 9531839B1 · Wang · 2016 [cited by examiner]
US 10248663B1 · Keisler · 2019 [cited by examiner]
US 10366083B2 · Chavan et al. · 2019 [cited by applicant]
US 10558659B2 · Hopeman et al. · 2020 [cited by applicant]
US 10776401B2 · Gross et al. · 2020 [cited by applicant]
US 10977234B2 · Arye et al. · 2021 [cited by applicant]
US 11138175B2 · Arye et al. · 2021 [cited by applicant]
US 11238039B2 · Chavan et al. · 2022 [cited by applicant]
US 11496483B1 · Babani · 2022 [cited by examiner]
US 20040243257A1 · Theimer · 2004 [cited by examiner]
US 20060095485A1 · Moore · 2006 [cited by examiner]
US 20080313128A1 · Arasu · 2008 [cited by examiner]
US 20150039628A1 · Sen et al. · 2015 [cited by applicant]
US 20150143112A1 · Yavuz et al. · 2015 [cited by applicant]
US 20150288691A1 · Dickie · 2015 [cited by applicant]
US 20160267135A1 · Idicula et al. · 2016 [cited by applicant]
US 20160350375A1 · Das et al. · 2016 [cited by applicant]
US 20170031976A1 · Chavan et al. · 2017 [cited by applicant]
US 20180081939A1 · Hopeman et al. · 2018 [cited by applicant]
US 20180081946A1 · Bondapalati et al. · 2018 [cited by applicant]
US 20180089261A1 · Li et al. · 2018 [cited by applicant]
US 20180165348A1 · Cole et al. · 2018 [cited by applicant]
US 20180217987A1 · Helland et al. · 2018 [cited by applicant]
US 20180276289A1 · Gross et al. · 2018 [cited by applicant]
US 20190205459A1 · Busjaeger et al. · 2019 [cited by applicant]
US 20190220461A1 · Chavan et al. · 2019 [cited by applicant]
US 20210034598A1 · Arye et al. · 2021 [cited by applicant]
US 20210149897A1 · Kim et al. · 2021 [cited by applicant]
US 20210191915A1 · Arye et al. · 2021 [cited by applicant]
US 20230120492A1 · Shalom · 2023 [cited by examiner]
United States Office Action, U.S. Appl. No. 18/310,460, filed May 21, 2024, 13 pages. [cited by applicant]
Dong, W., et al. “ASH: A modern framework for parallel spatial hashing in 3D perception,” IEEE transactions on pattern analysis and machine intelligence, vol. 45, Issue 5, Oct. 13, 2022, pp. 5417-5435. [cited by applicant]
Henderson, M. “Multi-way hash join effectiveness,” Diss. University of British Columbia, Jul. 2013, pp. 1-61. [cited by applicant]
Junger, D., et al. “General-purpose GPU hashing data structures and their application in accelerated genomics.” Journal of Parallel and Distributed Computing, vol. 163, May 2022, pp. 256-268. [cited by applicant]
Shin, H., et al. “Bucket-Sorted Hash Join,” Journal of Information Science & Engineering, vol. 36, Issue 1, 2020, pp. 171-190. [cited by applicant]
United States Office Action, U.S. Appl. No. 18/310,455, filed Sep. 18, 2024, 18 pages. [cited by applicant]