Skip to content

DuckDB Extension

Apache DataSketches

Build and merge Apache DataSketches in DuckDB. Estimate distinct counts, quantiles, and frequent items from compact summaries stored as BLOBs.

3,270,605
extension loads Β· last 90 days
On this page

Keep a small summary instead of every observation

A sketch summarizes a large collection of values in a compact data structure. Apache DataSketches provides algorithms for questions such as how many distinct values appeared, which items are frequent, or where a percentile falls.

This extension lets you build sketches from DuckDB columns, store them, and merge them later. For example, daily sketches can produce a longer-period estimate without rereading all the original rows. Choose the sketch family and size according to the question and the approximation you can accept.

Example

Estimate distinct visitors

Five sample events contain three distinct user IDs. Build an HLL sketch, then read its estimate.

Tested with DuckDB 1.5.6. Browser examples use Haybarn-Wasm 1.5.6.

INSTALL datasketches FROM community;
LOAD datasketches;

WITH events(user_id) AS (
  VALUES (101), (102), (101), (103), (102)
), summary AS (
  SELECT datasketch_hll(12, user_id) AS sketch FROM events
)
SELECT round(datasketch_hll_estimate(sketch), 2) AS estimated_users
FROM summary;

Expected result

estimated_users
3

This small example demonstrates the API. Sketches are useful when you need compact, mergeable summaries; their estimates are approximate.

Common tasks

Deep Dive

Technical Details

Reference

Extension Contents

Quick reference to all available functions and settings organized by category.

Array of Doubles
datasketch_aod() Object type: Aggregate function Aggregate (key, values DOUBLE[]) rows into an array-of-doubles Tuple sketch (sketch_aod): a Theta sketch of the distinct keys where each retained key carries a fixed-length array of DOUBLE values (1–255 values, the same length on every row, inferred from the data and stored in the sketch), summed element-wise per key.
datasketch_aod_a_not_b() Object type: Scalar function Returns a new array-of-doubles sketch with the keys (and their summaries) of sketch A that are not in sketch B (set difference)
datasketch_aod_column_means() Object type: Scalar function Returns the mean of each value column over the retained keys (the mean per distinct key), or NULL if the sketch retains no entries
datasketch_aod_column_sums() Object type: Scalar function Returns the estimated total of each value column over all distinct keys: the column sums of the retained entries divided by theta (exact when the sketch is not in estimation mode)
datasketch_aod_describe() Object type: Scalar function Returns a human-readable description of the array-of-doubles sketch
datasketch_aod_dissimilarity_test() Object type: Scalar function Returns true if the Jaccard similarity of the key sets is at most the threshold, with high confidence (its upper bound is <= threshold)
datasketch_aod_estimate() Object type: Scalar function Returns the estimated number of distinct keys in the array-of-doubles sketch
datasketch_aod_exactly_equal() Object type: Scalar function Returns true if the two sketches retain exactly the same keys with the same theta (summaries are not compared)
datasketch_aod_get_theta() Object type: Scalar function Returns the theta value of the array-of-doubles sketch (the fraction of the key hash space it retains)
datasketch_aod_intersect() Object type: Scalar function Returns the intersection of two or more array-of-doubles sketches: the keys present in every sketch, with their values summed element-wise
datasketch_aod_intersect_agg() Object type: Aggregate function Intersects array-of-doubles sketches across rows: keeps the keys present in every sketch, summing their values element-wise.
datasketch_aod_is_empty() Object type: Scalar function Returns true if the array-of-doubles sketch is empty
datasketch_aod_is_estimation_mode() Object type: Scalar function Returns true if the array-of-doubles sketch is in estimation mode (it has sampled the keys)
datasketch_aod_jaccard() Object type: Scalar function Returns the Jaccard similarity of the key sets of two sketches as a struct of its estimate and approximate lower and upper bounds (about 2 standard deviations).
datasketch_aod_lower_bound() Object type: Scalar function Returns the lower bound of the estimated number of distinct keys at the given number of standard deviations (1, 2, or 3)
datasketch_aod_num_retained() Object type: Scalar function Returns the number of entries (keys with their summaries) retained in the array-of-doubles sketch
datasketch_aod_num_values() Object type: Scalar function Returns the number of values per key of the array-of-doubles sketch
datasketch_aod_seed_hash() Object type: Scalar function Returns the 16-bit hash of the seed the array-of-doubles sketch was built with; sketches can only be combined if their seed hashes match
datasketch_aod_similarity_test() Object type: Scalar function Returns true if the Jaccard similarity of the key sets is at least the threshold, with high confidence (its lower bound is >= threshold)
datasketch_aod_summaries() Object type: Scalar function Returns the retained entries of the array-of-doubles sketch as a list of {hash, values} structs (the key hash and its values)
datasketch_aod_to_theta() Object type: Scalar function Converts the array-of-doubles sketch to a Theta sketch of its keys (dropping the summaries), usable with the datasketch_theta functions
datasketch_aod_union() Object type: Scalar function Returns the union of two or more array-of-doubles sketches (values of a key summed element-wise), keeping as many entries as the largest input (at least lg_k 12)
datasketch_aod_upper_bound() Object type: Scalar function Returns the upper bound of the estimated number of distinct keys at the given number of standard deviations (1, 2, or 3)
CPC
datasketch_cpc() Object type: Aggregate function Aggregate input values into a Compressed Probability Counting sketch β€” a distinct-count sketch that's roughly 40% smaller than HLL at the same accuracy, traded against slower serialization.
datasketch_cpc_describe() Object type: Scalar function Return a string representation of the sketch
datasketch_cpc_estimate() Object type: Scalar function Read the estimated distinct count from a CPC sketch.
datasketch_cpc_is_empty() Object type: Scalar function Return a boolean indicating if the sketch is empty
datasketch_cpc_lower_bound() Object type: Scalar function Return the lower bound of the number of distinct items seen by the sketch
datasketch_cpc_merge() Object type: Scalar function Scalar union of two CPC sketches β€” the row-wise counterpart of the datasketch_cpc_union aggregate.
datasketch_cpc_union() Object type: Aggregate function Merge a column of sketch_cpc BLOBs into one rollup sketch β€” the standard per-partition / per-day rollup pattern.
datasketch_cpc_upper_bound() Object type: Scalar function Return the upper bound of the number of distinct items seen by the sketch
Frequent Items
datasketch_frequent_items() Object type: Aggregate function Aggregate input values into a Frequent Items (heavy-hitter) sketch.
datasketch_frequent_items_epsilon() Object type: Scalar function Returns the epsilon value (relative error) of the sketch
datasketch_frequent_items_estimate() Object type: Scalar function Estimated frequency for a specific item.
datasketch_frequent_items_get_frequent() Object type: Scalar function Return the heavy-hitter candidates with per-item estimate, lower bound, and upper bound.
datasketch_frequent_items_is_empty() Object type: Scalar function Returns true if the sketch is empty
datasketch_frequent_items_lower_bound() Object type: Scalar function Returns the lower bound frequency estimate for a specific item
datasketch_frequent_items_num_active() Object type: Scalar function Returns the number of active items currently tracked by the sketch
datasketch_frequent_items_total_weight() Object type: Scalar function Returns the total weight (sum of all item counts) processed by the sketch
datasketch_frequent_items_upper_bound() Object type: Scalar function Returns the upper bound frequency estimate for a specific item
datasketch_frequent_items_weighted() Object type: Aggregate function Like datasketch_frequent_items, but each row adds a weight (BIGINT or UBIGINT; negative weights are rejected) instead of a count of one β€” approximate top-K by a metric such as revenue or bytes.
HLL
datasketch_hll() Object type: Aggregate function Aggregate input values into a HyperLogLog sketch for distinct counting.
datasketch_hll_composite_estimate() Object type: Scalar function Return the composite estimate of the number of distinct items, computed from the registers alone (the raw HLL estimate blended with linear counting).
datasketch_hll_describe() Object type: Scalar function Return a string representation of the sketch
datasketch_hll_estimate() Object type: Scalar function Read the estimated distinct count from an HLL sketch.
datasketch_hll_is_compact() Object type: Scalar function Return whether the sketch is in compact form
datasketch_hll_is_empty() Object type: Scalar function Return a boolean indicating if the sketch is empty
datasketch_hll_lg_config_k() Object type: Scalar function Return the value of log base 2 K for this sketch
datasketch_hll_lower_bound() Object type: Scalar function Lower bound of the HLL distinct-count estimate at a given number of standard deviations.
datasketch_hll_merge() Object type: Scalar function Scalar union of two HLL sketches β€” the row-wise counterpart of the datasketch_hll_union aggregate (the scalar is named _merge because a scalar and an aggregate cannot share a name).
datasketch_hll_target_type() Object type: Scalar function Return the sketch's register encoding: 'HLL_4', 'HLL_6' or 'HLL_8'
datasketch_hll_union() Object type: Aggregate function Merge multiple HLL sketches into one.
datasketch_hll_upper_bound() Object type: Scalar function Upper bound of the HLL distinct-count estimate at a given number of standard deviations.
KLL
datasketch_kll() Object type: Aggregate function Aggregate input values into a KLL quantile sketch.
datasketch_kll_cdf() Object type: Scalar function CDF over a list of split points β€” one call returns the cumulative rank at each.
datasketch_kll_describe() Object type: Scalar function Return a description of this sketch
datasketch_kll_is_empty() Object type: Scalar function Return a boolean indicating if the sketch is empty
datasketch_kll_is_estimation_mode() Object type: Scalar function Return a boolean indicating if the sketch is in estimation mode
datasketch_kll_k() Object type: Scalar function Return the value of K for this sketch
datasketch_kll_max_item() Object type: Scalar function Return the maximum item in the sketch
datasketch_kll_min_item() Object type: Scalar function Return the minimum item in the sketch
datasketch_kll_n() Object type: Scalar function Return the number of items contained in the sketch
datasketch_kll_normalized_rank_error() Object type: Scalar function Return the normalized rank error of the sketch
datasketch_kll_num_retained() Object type: Scalar function Return the number of retained items in the sketch
datasketch_kll_pmf() Object type: Scalar function PMF (probability mass) over a list of split points β€” fraction of the distribution falling in each bucket.
datasketch_kll_quantile() Object type: Scalar function Approximate quantile at a given rank β€” given a sketch and r ∈ [0, 1], returns the value at that rank in the sorted distribution.
datasketch_kll_quantiles() Object type: Scalar function Return the quantiles (items) at a list of normalized ranks in [0, 1].
datasketch_kll_rank() Object type: Scalar function Inverse of datasketch_kll_quantile β€” given a value, return its approximate rank r ∈ [0, 1] in the sorted distribution.
datasketch_kll_ranks() Object type: Scalar function Return the normalized ranks of a list of items.
datasketch_kll_sorted_view() Object type: Scalar function Return the sketch's sorted view: one entry per retained item in ascending order (equal items can appear more than once), with the item's weight and the inclusive cumulative weight (the number of input items less than or equal to it; estimated once the sketch is in estimation mode).
Quantiles
datasketch_quantiles() Object type: Aggregate function Aggregate input values into the classic mergeable quantiles sketch from the original DataSketches paper.
datasketch_quantiles_cdf() Object type: Scalar function CDF over a list of split points β€” the cumulative rank at each split point, plus a final 1.0.
datasketch_quantiles_describe() Object type: Scalar function Return a description of this sketch
datasketch_quantiles_is_empty() Object type: Scalar function Return a boolean indicating if the sketch is empty
datasketch_quantiles_is_estimation_mode() Object type: Scalar function Return a boolean indicating if the sketch is in estimation mode
datasketch_quantiles_k() Object type: Scalar function Return the value of K for this sketch
datasketch_quantiles_max_item() Object type: Scalar function Return the maximum item in the sketch
datasketch_quantiles_min_item() Object type: Scalar function Return the minimum item in the sketch
datasketch_quantiles_n() Object type: Scalar function Return the number of items contained in the sketch
datasketch_quantiles_normalized_rank_error() Object type: Scalar function Return the normalized rank error of the sketch
datasketch_quantiles_num_retained() Object type: Scalar function Return the number of retained items in the sketch
datasketch_quantiles_pmf() Object type: Scalar function PMF (probability mass) over a list of split points β€” the fraction of the distribution falling in each bucket.
datasketch_quantiles_quantile() Object type: Scalar function Approximate quantile at a given rank from a classic Quantiles sketch.
datasketch_quantiles_quantiles() Object type: Scalar function Return the quantiles (items) at a list of normalized ranks in [0, 1].
datasketch_quantiles_rank() Object type: Scalar function Approximate rank of a value within the classic Quantiles sketch.
datasketch_quantiles_ranks() Object type: Scalar function Return the normalized ranks of a list of items.
datasketch_quantiles_sorted_view() Object type: Scalar function Return the sketch's sorted view: one entry per retained item in ascending order (equal items can appear more than once), with the item's weight and the inclusive cumulative weight (the number of input items less than or equal to it; estimated once the sketch is in estimation mode).
REQ
datasketch_req() Object type: Aggregate function Aggregate input values into a Relative Error Quantile sketch.
datasketch_req_cdf() Object type: Scalar function CDF over a list of split points β€” the cumulative rank at each split point, plus a final 1.0.
datasketch_req_describe() Object type: Scalar function Return a description of this sketch
datasketch_req_is_empty() Object type: Scalar function Return a boolean indicating if the sketch is empty
datasketch_req_is_estimation_mode() Object type: Scalar function Return a boolean indicating if the sketch is in estimation mode
datasketch_req_is_hra() Object type: Scalar function Return true if the sketch favors accuracy at high ranks (HRA), false if it favors low ranks (LRA)
datasketch_req_k() Object type: Scalar function Return the value of K for this sketch
datasketch_req_max_item() Object type: Scalar function Return the maximum item in the sketch
datasketch_req_min_item() Object type: Scalar function Return the minimum item in the sketch
datasketch_req_n() Object type: Scalar function Return the number of items contained in the sketch
datasketch_req_num_retained() Object type: Scalar function Return the number of retained items in the sketch
datasketch_req_pmf() Object type: Scalar function PMF (probability mass) over a list of split points β€” the fraction of the distribution falling in each bucket.
datasketch_req_quantile() Object type: Scalar function Approximate quantile at a given rank from a REQ sketch.
datasketch_req_quantiles() Object type: Scalar function Return the quantiles (items) at a list of normalized ranks in [0, 1].
datasketch_req_rank() Object type: Scalar function Approximate rank of a value within the REQ sketch.
datasketch_req_rank_lower_bound() Object type: Scalar function Return an approximate lower bound of the given normalized rank, with a confidence of num_std_dev standard deviations (1, 2 or 3)
datasketch_req_rank_upper_bound() Object type: Scalar function Return an approximate upper bound of the given normalized rank, with a confidence of num_std_dev standard deviations (1, 2 or 3)
datasketch_req_ranks() Object type: Scalar function Return the normalized ranks of a list of items.
datasketch_req_sorted_view() Object type: Scalar function Return the sketch's sorted view: one entry per retained item in ascending order (equal items can appear more than once), with the item's weight and the inclusive cumulative weight (the number of input items less than or equal to it; estimated once the sketch is in estimation mode).
TDigest
datasketch_tdigest() Object type: Aggregate function Aggregate input values into a t-digest quantile sketch β€” most accurate at the tails (p99, p999), exactly where SLOs live.
datasketch_tdigest_cdf() Object type: Scalar function Return the Cumulative Distribution Function (CDF) of the sketch for a series of points
datasketch_tdigest_describe() Object type: Scalar function Return a description of this sketch
datasketch_tdigest_is_empty() Object type: Scalar function Return a boolean indicating if the sketch is empty
datasketch_tdigest_k() Object type: Scalar function Return the value of K for this sketch
datasketch_tdigest_max_value() Object type: Scalar function Exact maximum value seen by the t-digest.
datasketch_tdigest_min_value() Object type: Scalar function Exact minimum value seen by the t-digest.
datasketch_tdigest_pmf() Object type: Scalar function Return the Probability Mass Function (PMF) of the sketch for a series of points
datasketch_tdigest_quantile() Object type: Scalar function Approximate quantile at a given rank from a t-digest sketch.
datasketch_tdigest_rank() Object type: Scalar function Approximate rank of a value within the t-digest sketch.
datasketch_tdigest_total_weight() Object type: Scalar function Return the total weight of this sketch
Theta
datasketch_theta() Object type: Aggregate function Aggregate input values into a Theta sketch β€” the distinct-count family that supports set operations (union, intersect, A-not-B) beyond simple merge.
datasketch_theta_a_not_b() Object type: Scalar function Approximate |A \ B| β€” distinct items present in A but not in B.
datasketch_theta_blob() Object type: Aggregate function Hashes raw BLOB values (their bytes) into a Theta sketch, like datasketch_theta does for other types (datasketch_theta(BLOB) merges serialized sketches instead).
datasketch_theta_describe() Object type: Scalar function Returns a human-readable description of the Theta sketch
datasketch_theta_dissimilarity_test() Object type: Scalar function Returns true if the Jaccard similarity of the two sketches is at most the threshold, with high confidence (its upper bound is <= threshold)
datasketch_theta_estimate() Object type: Scalar function Read the estimated distinct count from a Theta sketch.
datasketch_theta_exactly_equal() Object type: Scalar function Returns true if the two sketches retain exactly the same hashes with the same theta, i.e.
datasketch_theta_get_seed() Object type: Scalar function Alias of datasketch_theta_seed_hash: returns the 16-bit seed hash stored in the sketch (it always returned the hash, not the seed).
datasketch_theta_get_theta() Object type: Scalar function Returns the theta value of the sketch (sampling probability)
datasketch_theta_intersect() Object type: Scalar function Approximate |A ∩ B| β€” distinct items present in both cohorts.
datasketch_theta_intersect_agg() Object type: Aggregate function Intersects Theta sketches across rows: the result estimates the number of distinct values present in every input sketch.
datasketch_theta_is_empty() Object type: Scalar function Returns true if the Theta sketch is empty
datasketch_theta_is_estimation_mode() Object type: Scalar function Returns true if the sketch is in estimation mode (has exceeded exact counting capacity)
datasketch_theta_jaccard() Object type: Scalar function Returns the Jaccard similarity |A ∩ B| / |A βˆͺ B| of two sketches as a struct of its estimate and approximate lower and upper bounds (about 2 standard deviations).
datasketch_theta_lower_bound() Object type: Scalar function Returns the lower bound estimate at the given number of standard deviations (1, 2, or 3)
datasketch_theta_num_retained() Object type: Scalar function Returns the number of hash values retained in the sketch
datasketch_theta_seed_hash() Object type: Scalar function Returns the 16-bit hash of the seed the sketch was built with (compact sketches store only this hash, not the seed); sketches can only be combined if their seed hashes match
datasketch_theta_similarity_test() Object type: Scalar function Returns true if the Jaccard similarity of the two sketches is at least the threshold, with high confidence (its lower bound is >= threshold)
datasketch_theta_union() Object type: Scalar function Approximate |A βˆͺ B βˆͺ …| β€” scalar union of two or more Theta sketches.
datasketch_theta_upper_bound() Object type: Scalar function Returns the upper bound estimate at the given number of standard deviations (1, 2, or 3)
Tuple
datasketch_tuple() Object type: Aggregate function Aggregate (key, value) rows into a Tuple sketch (sketch_tuple_double): a Theta sketch of the distinct keys in which every retained key carries a DOUBLE summary of its values.
datasketch_tuple_a_not_b() Object type: Scalar function Returns a new Tuple sketch with the keys (and their summaries) of sketch A that are not in sketch B (set difference)
datasketch_tuple_describe() Object type: Scalar function Returns a human-readable description of the Tuple sketch
datasketch_tuple_dissimilarity_test() Object type: Scalar function Returns true if the Jaccard similarity of the key sets is at most the threshold, with high confidence (its upper bound is <= threshold)
datasketch_tuple_estimate() Object type: Scalar function Returns the estimated number of distinct keys in the Tuple sketch
datasketch_tuple_exactly_equal() Object type: Scalar function Returns true if the two sketches retain exactly the same keys with the same theta (summaries are not compared)
datasketch_tuple_get_theta() Object type: Scalar function Returns the theta value of the Tuple sketch (the fraction of the key hash space it retains)
datasketch_tuple_intersect() Object type: Scalar function Returns the intersection of two or more Tuple sketches: the keys present in every sketch, with their summaries combined by mode := 'sum' (default), 'min', 'max' or 'one'
datasketch_tuple_intersect_agg() Object type: Aggregate function Intersects Tuple sketches across rows: keeps the keys present in every sketch, combining their summaries by mode := 'sum' (default), 'min', 'max' or 'one'.
datasketch_tuple_is_empty() Object type: Scalar function Returns true if the Tuple sketch is empty
datasketch_tuple_is_estimation_mode() Object type: Scalar function Returns true if the Tuple sketch is in estimation mode (it has sampled the keys)
datasketch_tuple_jaccard() Object type: Scalar function Returns the Jaccard similarity of the key sets of two sketches as a struct of its estimate and approximate lower and upper bounds (about 2 standard deviations).
datasketch_tuple_lower_bound() Object type: Scalar function Returns the lower bound of the estimated number of distinct keys at the given number of standard deviations (1, 2, or 3)
datasketch_tuple_mean() Object type: Scalar function Returns the mean summary per distinct key (the mean of the retained summaries), or NULL if the sketch retains no entries
datasketch_tuple_num_retained() Object type: Scalar function Returns the number of entries (keys with their summaries) retained in the Tuple sketch
datasketch_tuple_seed_hash() Object type: Scalar function Returns the 16-bit hash of the seed the Tuple sketch was built with; sketches can only be combined if their seed hashes match
datasketch_tuple_similarity_test() Object type: Scalar function Returns true if the Jaccard similarity of the key sets is at least the threshold, with high confidence (its lower bound is >= threshold)
datasketch_tuple_sum() Object type: Scalar function Returns the estimated total of the summaries over all distinct keys: the sum of the retained summaries divided by theta (with mode 'sum', the estimated sum of the values; exact when the sketch is not in estimation mode)
datasketch_tuple_summaries() Object type: Scalar function Returns the retained entries of the Tuple sketch as a list of {hash, summary} structs (the key hash and its summary)
datasketch_tuple_to_theta() Object type: Scalar function Converts the Tuple sketch to a Theta sketch of its keys (dropping the summaries), usable with the datasketch_theta functions
datasketch_tuple_union() Object type: Scalar function Returns the union of two or more Tuple sketches, keeping as many entries as the largest input (at least lg_k 12); the summaries of a key are combined by mode := 'sum' (default), 'min', 'max' or 'one'
datasketch_tuple_upper_bound() Object type: Scalar function Returns the upper bound of the estimated number of distinct keys at the given number of standard deviations (1, 2, or 3)
Types
sketch_aod Object type: Logical type Logical type registered by this extension.
sketch_cpc Object type: Logical type Logical type registered by this extension.
sketch_frequent_items Object type: Logical type Logical type registered by this extension.
sketch_hll Object type: Logical type Logical type registered by this extension.
sketch_kll_bigint Object type: Logical type Logical type registered by this extension.
sketch_kll_double Object type: Logical type Logical type registered by this extension.
sketch_kll_float Object type: Logical type Logical type registered by this extension.
sketch_kll_integer Object type: Logical type Logical type registered by this extension.
sketch_kll_smallint Object type: Logical type Logical type registered by this extension.
sketch_kll_tinyint Object type: Logical type Logical type registered by this extension.
sketch_kll_ubigint Object type: Logical type Logical type registered by this extension.
sketch_kll_uinteger Object type: Logical type Logical type registered by this extension.
sketch_kll_usmallint Object type: Logical type Logical type registered by this extension.
sketch_kll_utinyint Object type: Logical type Logical type registered by this extension.
sketch_kll_varchar Object type: Logical type Logical type registered by this extension.
sketch_quantiles_bigint Object type: Logical type Logical type registered by this extension.
sketch_quantiles_double Object type: Logical type Logical type registered by this extension.
sketch_quantiles_float Object type: Logical type Logical type registered by this extension.
sketch_quantiles_integer Object type: Logical type Logical type registered by this extension.
sketch_quantiles_smallint Object type: Logical type Logical type registered by this extension.
sketch_quantiles_tinyint Object type: Logical type Logical type registered by this extension.
sketch_quantiles_ubigint Object type: Logical type Logical type registered by this extension.
sketch_quantiles_uinteger Object type: Logical type Logical type registered by this extension.
sketch_quantiles_usmallint Object type: Logical type Logical type registered by this extension.
sketch_quantiles_utinyint Object type: Logical type Logical type registered by this extension.
sketch_quantiles_varchar Object type: Logical type Logical type registered by this extension.
sketch_req_bigint Object type: Logical type Logical type registered by this extension.
sketch_req_double Object type: Logical type Logical type registered by this extension.
sketch_req_float Object type: Logical type Logical type registered by this extension.
sketch_req_integer Object type: Logical type Logical type registered by this extension.
sketch_req_smallint Object type: Logical type Logical type registered by this extension.
sketch_req_tinyint Object type: Logical type Logical type registered by this extension.
sketch_req_ubigint Object type: Logical type Logical type registered by this extension.
sketch_req_uinteger Object type: Logical type Logical type registered by this extension.
sketch_req_usmallint Object type: Logical type Logical type registered by this extension.
sketch_req_utinyint Object type: Logical type Logical type registered by this extension.
sketch_tdigest_double Object type: Logical type Logical type registered by this extension.
sketch_tdigest_float Object type: Logical type Logical type registered by this extension.
sketch_theta Object type: Logical type Logical type registered by this extension.
sketch_tuple_double Object type: Logical type Logical type registered by this extension.

API Reference

Function Reference

Data model

Registered Types

Logical types this extension adds to DuckDB. Functions in the reference may accept or return these names directly.

  • sketch_aod

    Logical type registered by this extension.

  • sketch_cpc

    Logical type registered by this extension.

  • sketch_frequent_items

    Logical type registered by this extension.

  • sketch_hll

    Logical type registered by this extension.

  • sketch_kll_bigint

    Logical type registered by this extension.

  • sketch_kll_double

    Logical type registered by this extension.

  • sketch_kll_float

    Logical type registered by this extension.

  • sketch_kll_integer

    Logical type registered by this extension.

  • sketch_kll_smallint

    Logical type registered by this extension.

  • sketch_kll_tinyint

    Logical type registered by this extension.

  • sketch_kll_ubigint

    Logical type registered by this extension.

  • sketch_kll_uinteger

    Logical type registered by this extension.

  • sketch_kll_usmallint

    Logical type registered by this extension.

  • sketch_kll_utinyint

    Logical type registered by this extension.

  • sketch_kll_varchar

    Logical type registered by this extension.

  • sketch_quantiles_bigint

    Logical type registered by this extension.

  • sketch_quantiles_double

    Logical type registered by this extension.

  • sketch_quantiles_float

    Logical type registered by this extension.

  • sketch_quantiles_integer

    Logical type registered by this extension.

  • sketch_quantiles_smallint

    Logical type registered by this extension.

  • sketch_quantiles_tinyint

    Logical type registered by this extension.

  • sketch_quantiles_ubigint

    Logical type registered by this extension.

  • sketch_quantiles_uinteger

    Logical type registered by this extension.

  • sketch_quantiles_usmallint

    Logical type registered by this extension.

  • sketch_quantiles_utinyint

    Logical type registered by this extension.

  • sketch_quantiles_varchar

    Logical type registered by this extension.

  • sketch_req_bigint

    Logical type registered by this extension.

  • sketch_req_double

    Logical type registered by this extension.

  • sketch_req_float

    Logical type registered by this extension.

  • sketch_req_integer

    Logical type registered by this extension.

  • sketch_req_smallint

    Logical type registered by this extension.

  • sketch_req_tinyint

    Logical type registered by this extension.

  • sketch_req_ubigint

    Logical type registered by this extension.

  • sketch_req_uinteger

    Logical type registered by this extension.

  • sketch_req_usmallint

    Logical type registered by this extension.

  • sketch_req_utinyint

    Logical type registered by this extension.

  • sketch_tdigest_double

    Logical type registered by this extension.

  • sketch_tdigest_float

    Logical type registered by this extension.

  • sketch_theta

    Logical type registered by this extension.

  • sketch_tuple_double

    Logical type registered by this extension.

Practical Examples

Cookbook

Real-world recipes and patterns for common use cases.

Platform Support

Compatibility

Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.

Quick Facts

Release status Stable
Software License Apache-2.0
Pricing Free
Written In C++
Source Available Yes
View on GitHub
Usage
3,270,605
loads Β· last 90 days

Platforms

DuckDB 2.0.0

  • Linux x86_64 aarch64
  • Linux (musl) Not available
  • macOS Apple Silicon
  • Windows x86_64 x86_64 (MinGW)
  • WASM Not available
Compiled binary sizes
Platform Architecture Size
Linux x86_64 6.10 MB
Linux aarch64 5.11 MB
macOS Apple Silicon 4.50 MB
Windows x86_64 11.61 MB
Windows x86_64 (MinGW) 19.79 MB

Compressed download sizes for the release shown above.

DuckDB & Haybarn

Release calendar
  • DuckDB v2.0.0 Query.Farm repository Supported
  • Haybarn v1.5.6 Built-in community repository Supported

Browser examples use Haybarn-Wasm 1.5.6.

Checked .