# US 10,372,723 B2 · Efficient query processing using histograms in a columnar database

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,372,723 B2
- Document ID: US10372723B2
- Status: Granted
- Kind: B2
- Application number: 15/706,511
- Filed: 2017-09-15
- Published: 2018-01-25
- Granted: 2019-08-06
- Earliest claimed: 2013-01-15
- Assignees: Amazon Technologies, Inc.
- Applicants: Amazon Technologies, Inc.
- Inventors: Anurag Windlass Gupta
- Web page: https://patentgrep.com/patent/US10372723B2

## CPC

- G06F 16/254: {Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses}
- G06F 16/221: {Column-oriented storage; Management thereof}
- G06F 16/2237: {Vectors, bitmaps or matrices}
- G06F 16/245: Query processing
- G06F 16/24554: {Unary operations; Data partitioning operations}
- G06F 16/278: {Data partitioning, e.g. horizontal or vertical partitioning}
- G06F 16/283: {Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A probabilistic data structure is generated for efficient query processing using a histogram for unsorted data in a column of a columnar database. A bucket range size is determined for multiples buckets of a histogram of a column in a columnar database table. In at least some embodiments, the histogram may be a height-balanced histogram. A probabilistic data structure is generated to indicate for which particular buckets in the histogram there is a data value stored in the data block. When an indication of a query directed to the column for select data is received, the probabilistic data structure for each of the data blocks storing data for the column may be examined to determine particular ones of the data blocks which do not need to be read in order to service the query for the select data.

## Claims

### Claim 1

A system, comprising:
one or more hardware processors and memory with program instructions to:
determine a bucket range size for each of a plurality of buckets for a histogram of a column of a columnar database table, wherein each bucket of the plurality of buckets represents an existence of one or more data values of the data in the column within a range of values according to the determined bucket range size;
generate a probabilistic data structure for each of one or more data blocks storing data for the column of the columnar database table, wherein the probabilistic data structure indicates for which particular buckets of the plurality of buckets in the histogram there is a data value stored in the data block; and
examine the probabilistic data structure, responsive to a query, for each of the one or more data blocks storing data for the column to determine ones of the one or more data blocks which do not need to be read in order to service the query.

### Claim 2 (depends on 1)

The system of claim 1, wherein to determine the plurality of bucket range sizes for the histogram of the column of the columnar database table, the program instructions are executable to:
obtain the data of the column;
generate the plurality of buckets; and
set a bucket range size of the plurality of bucket range sizes for each bucket for the histogram such that the data of the column is evenly distributed among the buckets.

### Claim 3 (depends on 1)

The system of claim 1, wherein the probabilistic data structure is a bitmap comprising a plurality of bits, wherein each bit of the bitmap represents each bucket of the plurality of buckets for the histogram, and for every data value included in the bucket range size stored in the data block the bit of the bitmap corresponding to the bucket is set.

### Claim 4 (depends on 1)

The system of claim 1, wherein the program instructions are executable to store the probabilistic data structure of each of the one or more data blocks in a respective entry in a block metadata structure that stores information about the one or more data blocks.

### Claim 5 (depends on 1)

The system of claim 1, further comprising at least one compute node as a leader node of a distributed data warehouse cluster.

### Claim 6 (depends on 1)

The system of claim 1, wherein the histogram of the column of the columnar database table is a height-balanced histogram.

### Claim 7 (depends on 6)

The system of claim 6, the program instructions are executable to:
detect a rebalancing event for the distribution of data in the column among the plurality of buckets;
in response to detecting the rebalancing event:
modify the bucket range size for each of the plurality of buckets for the height-balanced histogram of the column; and
update each probabilistic data structure for each of the one or more data blocks according to the modified bucket range size of the plurality of buckets.

### Claim 8

A method, comprising:
performing, by one or more computing devices comprising one or more hardware processors and memory:
determining a bucket range size for each of a plurality of buckets for a histogram of a column of a columnar database table, wherein each bucket of the plurality of buckets represents an existence of one or more data values of the data in the column within a range of values according to the determined bucket range size;
generating a probabilistic data structure for each of one or more data blocks storing data for the column of the columnar database table, wherein the probabilistic data structure indicates for which particular buckets of the plurality of buckets in the histogram there is a data value stored in the data block; and
examining the probabilistic data structure, responsive to a query, for each of the one or more data blocks storing data for the column to determine ones of the one or more data blocks which do not need to be read in order to service the query.

### Claim 9 (depends on 8)

The method of claim 8, wherein said determining a bucket range size for each of a plurality of buckets for the histogram of the column of the columnar database table comprises:
obtaining the data of the column;
generating the plurality of buckets; and
setting a bucket range size of the plurality of bucket range sizes for each bucket such that the data of the column is evenly distributed among the buckets.

### Claim 10 (depends on 8)

The method of claim 8, wherein said generating the probabilistic data structure for each of the one or more data blocks storing data for the column of the columnar database table comprises:
generating a bitmap for the data block comprising a plurality of bits, wherein each bit represents a different bucket of the plurality of buckets for the histogram; and
setting the respective bit in the bitmap for each of the particular buckets for which there is the data value stored in the data block.

### Claim 11 (depends on 10)

The method of claim 10, further comprising storing the probabilistic data structure of each of the one or more data blocks in a respective entry in a block metadata structure that stores information about the one or more data blocks.

### Claim 12 (depends on 11)

The method of claim 11, wherein said examining the probabilistic data structure for each of the one or more data blocks storing data for the column to determine the particular ones of the one or more data blocks which do not need to be read in order to service the query for the select data comprises:
determining one or more bits representing the one or more buckets within the range of values including the select data; and
examining the one or more bits in each bitmap stored in the block metadata structure for the one or more data blocks to identify those data blocks without one of the one or more bits set as the particular ones which do not need to be read in order to service the query for the select data.

### Claim 13 (depends on 8)

The method of claim 8, wherein the histogram of the column of the columnar database table is a height-balanced histogram.

### Claim 14 (depends on 13)

The method of claim 13, further comprising:
detecting a rebalancing event for the distribution of data in the column among the plurality of buckets;
in response to detecting the rebalancing event:
modifying the bucket range size for each of the plurality of buckets for the height-balanced histogram of the column; and
updating each probabilistic data structure for each of the one or more data blocks according to the modified bucket range size of the plurality of buckets.

### Claim 15

A non-transitory, computer-readable storage medium, storing program instructions that when executed by one or more computing devices implement:
determining a bucket range size for each of a plurality of buckets for a histogram of a column of a columnar database table, wherein each bucket of the plurality of buckets represents an existence of one or more data values of the data in the column within a range of values according to the determined bucket range size;
generating a probabilistic data structure for each of one or more data blocks storing data for the column of the columnar database table, wherein the probabilistic data structure indicates for which particular buckets of the plurality of buckets in the histogram there is a data value stored in the data block; and
examining the probabilistic data structure, responsive to a query, for each of the one or more data blocks storing data for the column to determine ones of the one or more data blocks which do not need to be read in order to service the query.

### Claim 16 (depends on 15)

The non-transitory, computer-readable storage medium of claim 15, wherein the program instructions when further executed by the one or more computing devices implement:
obtaining the data of the column;
generating the plurality of buckets; and
setting a bucket range size of the plurality of bucket range sizes for each bucket such that the data of the column is evenly distributed among the buckets.

### Claim 17 (depends on 15)

The non-transitory, computer-readable storage medium of claim 15, wherein the probabilistic data structure is a bitmap comprising a plurality of bits, wherein each bit of the bitmap represents each bucket of the plurality of buckets for the height-balanced histogram, and for every data value included in the bucket range size stored in the data block the bit of the bitmap corresponding to the bucket is set.

### Claim 18 (depends on 15)

The non-transitory, computer-readable storage medium of claim 15, wherein the height-balanced histogram generator is further configured to store the probabilistic data structure of each of the one or more data blocks in a respective entry in a block metadata structure that stores information about the one or more data blocks.

### Claim 19 (depends on 15)

The non-transitory, computer-readable storage medium of claim 15, wherein the program instructions when further executed by the one or more computing devices implement a leader node of a distributed data warehouse cluster.

### Claim 20 (depends on 15)

The non-transitory, computer-readable storage medium of claim 15, wherein the histogram for the column of the columnar database table is a height-balanced histogram, and wherein the program instructions when further executed by the one or more computing devices implement:
detecting a rebalancing event for the distribution of data in the column among the plurality of buckets;
in response to detecting the rebalancing event:
modifying the bucket range size for each of the plurality of buckets for the height-balanced histogram of the column; and
updating each probabilistic data structure for each of the one or more data blocks according to the modified bucket range size of the plurality of buckets.
