🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 89 (from laksa188)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
CRAWLED
3 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.1 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://clickhouse.com/docs/sql-reference/aggregate-functions/reference
Last Crawled2026-04-03 20:09:43 (3 days ago)
First Indexed2025-02-21 03:23:37 (1 year ago)
HTTP Status Code200
Meta TitleAggregate Functions | ClickHouse Docs
Meta DescriptionLanding page for aggregate functions with complete list of aggregate functions
Meta Canonicalnull
Boilerpipe Text
aggThrow This function can be used for the purpose of testing exception safety. It will throw an exception on creation with the specified probability. analysisOfVariance Provides a statistical test for one-way analysis of variance (ANOVA test). It is a test over several groups of normally distributed observations to find out whether all groups have the same mean or not. any Selects the first encountered value of a column. anyHeavy Selects a frequently occurring value using the heavy hitters algorithm. If there is a value that occurs more than in half the cases in each of the query execution threads, this value is returned. Normally, the result is nondeterministic. anyLast Selects the last encountered value of a column. approx_top_k Returns an array of the approximately most frequent values and their counts in the specified column. approx_top_sum Returns an array of the approximately most frequent values and their counts in the specified column. argAndMax Calculates the arg and val value for a maximum val value. If there are multiple rows with equal val being the maximum, which of the associated arg and val is returned is not deterministic. argAndMin Calculates the arg and val value for a minimum val value. If there are multiple rows with equal val being the minimum, which of the associated arg and val is returned is not deterministic. argMax Calculates the arg value for a maximum val value. argMin Calculates the arg value for a minimum val value. If there are multiple rows with equal val being the maximum, which of the associated arg is returned is not deterministic. avg Calculates the arithmetic mean. avgWeighted Calculates the weighted arithmetic mean. boundingRatio Aggregate function that calculates the slope between the leftmost and rightmost points across a group of values. categoricalInformationValue Calculates the value of (P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0))) for each category. contingency The contingency function calculates the contingency coefficient, a value that measures the association between two columns in a table. The computation is similar to the cramersV function but with a different denominator in the square root. corr Calculates the Pearson correlation coefficient. corrMatrix Computes the correlation matrix over N variables. corrStable Calculates the Pearson correlation coefficient, but uses a numerically stable algorithm. count Counts the number of rows or not-NULL values. covarPop Calculates the population covariance covarPopMatrix Returns the population covariance matrix over N variables. covarPopStable Calculates the value of the population covariance covarSamp Calculates the value of Σ((x - x̅)(y - y̅)) / (n - 1) covarSampMatrix Returns the sample covariance matrix over N variables. covarSampStable Similar to covarSamp but works slower while providing a lower computational error. cramersV The result of the cramersV function ranges from 0 (corresponding to no association between the variables) to 1 and can reach 1 only when each value is completely determined by the other. It may be viewed as the association between two variables as a percentage of their maximum possible variation. cramersVBiasCorrected Calculates Cramer's V, but uses a bias correction. deltaSum Sums the arithmetic difference between consecutive rows. deltaSumTimestamp Adds the difference between consecutive rows. If the difference is negative, it is ignored. distinctDynamicTypes Calculates the list of distinct data types stored in Dynamic column. distinctJSONPaths Calculates a list of distinct paths stored in a JSON column. distinctJSONPathsAndTypes Calculates the list of distinct paths and their types stored in JSON entropy Calculates Shannon entropy of for a column of values. estimateCompressionRatio Estimates the compression ratio of a given column without compressing it. exponentialMovingAverage Calculates the exponential moving average of values for the determined time. exponentialTimeDecayedAvg Returns the exponentially smoothed weighted moving average of values of a time series at point t in time. exponentialTimeDecayedCount Returns the cumulative exponential decay over a time series at the index t in time. exponentialTimeDecayedMax Returns the maximum of the computed exponentially smoothed moving average at index t in time with that at t-1 . exponentialTimeDecayedSum Returns the sum of exponentially smoothed moving average values of a time series at the index t in time. first_value It is an alias for any but it was introduced for compatibility with Window Functions, where sometimes it is necessary to process NULL values (by default all ClickHouse aggregate functions ignore NULL values). flameGraph Aggregate function which builds a flamegraph using the list of stacktraces. groupArray Creates an array of argument values. Values can be added to the array in any (indeterminate) order. groupArrayArray Aggregates arrays into a larger array of those arrays. groupArrayInsertAt Inserts a value into the array at the specified position. groupArrayIntersect Return an intersection of given arrays (Return all items of arrays, that are in all given arrays). groupArrayLast Creates an array of the last argument values. groupArrayMovingAvg Calculates the moving average of input values. groupArrayMovingSum Calculates the moving sum of input values. groupArraySample Creates an array of sample argument values. The size of the resulting array is limited to max_size elements. Argument values are selected and added to the array randomly. groupArraySorted Returns an array with the first N items in ascending order. groupBitAnd Applies bit-wise AND for series of numbers. groupBitmap Bitmap or Aggregate calculations from a unsigned integer column, return cardinality of type UInt64, if add suffix -State, then return a bitmap object groupBitmapAnd Calculations the AND of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return a bitmap object. groupBitmapOr Calculations the OR of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return a bitmap object. This is equivalent to groupBitmapMerge . groupBitmapXor Calculates the XOR of a bitmap column, and returns the cardinality of type UInt64, if used with suffix -State, then it returns a bitmap object groupBitOr Applies bit-wise OR to a series of numbers. groupBitXor Applies bit-wise XOR for series of numbers. groupConcat Calculates a concatenated string from a group of strings, optionally separated by a delimiter, and optionally limited by a maximum number of elements. groupUniqArray Creates an array from different argument values. intervalLengthSum Calculates the total length of union of all ranges (segments on numeric axis). kolmogorovSmirnovTest Applies Kolmogorov-Smirnov's test to samples from two populations. kurtPop Computes the kurtosis of a sequence. kurtSamp Computes the sample kurtosis of a sequence. largestTriangleThreeBuckets Applies the Largest-Triangle-Three-Buckets algorithm to the input data. last_value Selects the last encountered value, similar to anyLast , but could accept NULL. mannWhitneyUTest Applies the Mann-Whitney rank test to samples from two populations. max Aggregate function that calculates the maximum across a group of values. maxIntersections Aggregate function that calculates the maximum number of times that a group of intervals intersects each other (if all the intervals intersect at least once). maxIntersectionsPosition Aggregate function that calculates the positions of the occurrences of the maxIntersections function. maxMap Calculates the maximum from value array according to the keys specified in the key array. meanZTest Applies mean z-test to samples from two populations. median The median* functions are the aliases for the corresponding quantile* functions. They calculate median of a numeric data sample. min Aggregate function that calculates the minimum across a group of values. minMap Calculates the minimum from value array according to the keys specified in the key array. quantile Computes an approximate quantile of a numeric data sequence. quantileBFloat16 Computes an approximate quantile of a sample consisting of bfloat16 numbers. quantileDD Computes an approximate quantile of a sample with relative-error guarantees. quantileDeterministic Computes an approximate quantile of a numeric data sequence. quantileExact Functions quantileExact, quantileExactLow, quantileExactHigh, quantileExactExclusive, quantileExactInclusive functions quantileExactExclusive Exactly computes the quantile of a numeric data sequence. quantileExactHigh Similar to quantileExact, this computes the exact quantile of a numeric data sequence. quantileExactInclusive Exactly computes the quantile of a numeric data sequence. quantileExactLow Similar to quantileExact, this computes the exact quantile of a numeric data sequence. quantileExactWeighted Exactly computes the quantile of a numeric data sequence, taking into account the weight of each element. quantileExactWeightedInterpolated Computes quantile of a numeric data sequence using linear interpolation, taking into account the weight of each element. quantileGK Computes the quantile of a numeric data sequence using the Greenwald-Khanna algorithm. quantileInterpolatedWeighted Computes quantile of a numeric data sequence using linear interpolation, taking into account the weight of each element. quantilePrometheusHistogram Computes quantile of a histogram using linear interpolation. quantiles Functions quantiles, quantilesExactExclusive, quantilesExactInclusive, quantilesGK quantilesExactExclusive Exactly computes the quantiles of a numeric data sequence. quantilesExactInclusive Exactly computes the quantiles of a numeric data sequence. quantilesGK quantilesGK works similarly to quantileGK but allows us to calculate quantities at different levels simultaneously and returns an array. quantilesTimingWeighted With the determined precision computes the quantile of a numeric data sequence according to the weight of each sequence member. quantileTDigest Computes an approximate quantile of a numeric data sequence using the t-digest algorithm. quantileTDigestWeighted Computes an approximate quantile of a numeric data sequence using the t-digest algorithm. quantileTiming With the determined precision computes the quantile of a numeric data sequence. quantileTimingWeighted With the determined precision computes the quantile of a numeric data sequence according to the weight of each sequence member. rankCorr Computes a rank correlation coefficient. simpleLinearRegression Performs simple (unidimensional) linear regression. singleValueOrNull The aggregate function singleValueOrNull is used to implement subquery operators, such as x = ALL (SELECT ...) . It checks if there is only one unique non-NULL value in the data. skewPop Computes the skewness of a sequence. skewSamp Computes the sample skewness of a sequence. sparkbar The function plots a frequency histogram for values x and the repetition rate y of these values over the interval [min_x, max_x] . stddevPop The result is equal to the square root of varPop. stddevPopStable The result is equal to the square root of varPop. Unlike stddevPop, this function uses a numerically stable algorithm. stddevSamp The result is equal to the square root of varSamp stddevSampStable The result is equal to the square root of varSamp. Unlike this function uses a numerically stable algorithm. stochasticLinearRegression This function implements stochastic linear regression. It supports custom parameters for learning rate, L2 regularization coefficient, mini-batch size, and has a few methods for updating weights (Adam, simple SGD, Momentum, Nesterov.) stochasticLogisticRegression This function implements stochastic logistic regression. It can be used for binary classification problem, supports the same custom parameters as stochasticLinearRegression and works the same way. studentTTest Applies the student t-test to samples from two populations. studentTTestOneSample Applies the one-sample Student t-test to a sample and a known population mean. sum Calculates the sum. Only works for numbers. sumCount Calculates the sum of the numbers and counts the number of rows at the same time. The function is used by ClickHouse query optimizer: if there are multiple sum , count or avg functions in a query, they can be replaced to single sumCount function to reuse the calculations. The function is rarely needed to use explicitly. sumKahan Calculates the sum of the numbers with Kahan compensated summation algorithm sumMap Totals one or more value arrays according to the keys specified in the key array. Returns a tuple of arrays: keys in sorted order, followed by values summed for the corresponding keys without overflow. sumMapWithOverflow Totals a value array according to the keys specified in the key array. Returns a tuple of two arrays: keys in sorted order, and values summed for the corresponding keys. Differs from the sumMap function in that it does summation with overflow. sumWithOverflow Computes the sum of the numbers, using the same data type for the result as for the input parameters. If the sum exceeds the maximum value for this data type, it is calculated with overflow. theilsU The theilsU function calculates Theils' U uncertainty coefficient, a value that measures the association between two columns in a table. timeSeriesChangesToGrid Aggregate function that calculates PromQL-like changes over time series data on the specified grid. timeSeriesDeltaToGrid Aggregate function that calculates PromQL-like delta over time series data on the specified grid. timeSeriesDerivToGrid Aggregate function that calculates PromQL-like derivative over time series data on the specified grid. timeSeriesGroupArray Sorts time series by timestamp in ascending order. timeSeriesInstantDeltaToGrid Aggregate function that calculates PromQL-like idelta over time series data on the specified grid. timeSeriesInstantRateToGrid Aggregate function that calculates PromQL-like irate over time series data on the specified grid. timeSeriesLastTwoSamples Aggregate function for re-sampling time series data for PromQL-like irate and idelta calculation timeSeriesPredictLinearToGrid Aggregate function that calculates PromQL-like linear prediction over time series data on the specified grid. timeSeriesRateToGrid Aggregate function that calculates PromQL-like rate over time series data on the specified grid. timeSeriesResampleToGridWithStaleness Aggregate function that re-samples time series data to the specified grid. timeSeriesResetsToGrid Aggregate function that calculates PromQL-like resets over time series data on the specified grid. topK Returns an array of the approximately most frequent values in the specified column. The resulting array is sorted in descending order of approximate frequency of values (not by the values themselves). topKWeighted Returns an array of the approximately most frequent values in the specified column. The resulting array is sorted in descending order of approximate frequency of values (not by the values themselves). Additionally, the weight of the value is taken into account. uniq Calculates the approximate number of different values of the argument. uniqCombined Calculates the approximate number of different argument values. uniqCombined64 Calculates the approximate number of different argument values. It is the same as uniqCombined, but uses a 64-bit hash for all data types rather than just for the String data type. uniqExact Calculates the exact number of different argument values. uniqHLL12 Calculates the approximate number of different argument values, using the HyperLogLog algorithm. uniqTheta Calculates the approximate number of different argument values, using the Theta Sketch Framework. varPop Calculates the population variance. varPopStable Returns the population variance. Unlike varPop , this function uses a numerically stable algorithm. It works slower but provides a lower computational error. varSamp Calculate the sample variance of a data set. varSampStable Calculate the sample variance of a data set. Unlike varSamp , this function uses a numerically stable algorithm. It works slower but provides a lower computational error. welchTTest Applies Welch's t-test to samples from two populations.
Markdown
[Skip to main content](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference#__docusaurus_skipToContent_fallback) [![ClickHouse](https://clickhouse.com/docs/img/ch_logo_docs.svg)](https://clickhouse.com/) - [Products](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [ClickHouse Cloud Best way to use ClickHouse. Available on AWS, GCP, and Azure.](https://clickhouse.com/cloud) - [BYOC (Bring Your Own Cloud) The fully managed ClickHouse Cloud service, Can be deployed in your AWS account.](https://clickhouse.com/cloud/bring-your-own-cloud) - [ClickHouse Set up a database with open-source ClickHouse. ClickHouse](https://clickhouse.com/clickhouse) - [Discover more than 100 integrations.](https://clickhouse.com/integrations) [Discover more than 100 integrations.](https://clickhouse.com/integrations) - [Use cases](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [Real-time analytics](https://clickhouse.com/use-cases/real-time-analytics) - [Machine Learning & Generative AI](https://clickhouse.com/use-cases/machine-learning-and-data-science) - [Business Intelligence](https://clickhouse.com/use-cases/data-warehousing) - [Logs, Events, Traces](https://clickhouse.com/use-cases/observability) - [All use cases](https://clickhouse.com/use-cases) [All use cases](https://clickhouse.com/use-cases) - [Documentation](https://clickhouse.com/docs) - [Resources](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [User stories](https://clickhouse.com/user-stories) - [Blog](https://clickhouse.com/blog) - [Events](https://clickhouse.com/company/events) - [Learning and certification](https://clickhouse.com/learn) - [Comparison](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [BigQuery](https://clickhouse.com/comparison/bigquery) - [PostgreSQL](https://clickhouse.com/comparison/postgresql) - [Redshift](https://clickhouse.com/comparison/redshift) - [Rockset](https://clickhouse.com/comparison/rockset) - [Snowflake](https://clickhouse.com/comparison/snowflake) - [Video](https://clickhouse.com/videos) - [Demo](https://clickhouse.com/demos) - [Pricing](https://clickhouse.com/pricing) - [Contact](https://clickhouse.com/company/contact?loc=nav) [46\.7k](https://github.com/ClickHouse/ClickHouse?utm_source=clickhouse&utm_medium=website&utm_campaign=website-nav) [Search`Ctrl``K`](https://clickhouse.com/docs/search) [Sign in](https://console.clickhouse.cloud/signIn?loc=docs-nav-signIn-cta&glxid=f3d9dfaf-92f3-4b93-8269-13da799d3f21&pagePath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&origPath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&utm_ga=GA1.1.1011770293.1775246985) [Get started](https://console.clickhouse.cloud/signUp?loc=docs-nav-signUp-cta&glxid=f3d9dfaf-92f3-4b93-8269-13da799d3f21&pagePath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&origPath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&utm_ga=GA1.1.1011770293.1775246985) [Get started](https://clickhouse.com/docs/introduction-clickhouse) [Cloud](https://clickhouse.com/docs/cloud/overview) [Manage data](https://clickhouse.com/docs/updating-data) [Server admin](https://clickhouse.com/docs/guides/manage-and-deploy-index) [Reference](https://clickhouse.com/docs/sql-reference) [Integrations](https://clickhouse.com/docs/integrations) [ClickStack](https://clickhouse.com/docs/use-cases/observability/clickstack/overview) [chDB](https://clickhouse.com/docs/chdb) [About](https://clickhouse.com/docs/about) [Knowledge Base](https://clickhouse.com/docs/knowledgebase) [English](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [English](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [日本語](https://clickhouse.com/docs/jp/sql-reference/aggregate-functions/reference) - [中文](https://clickhouse.com/docs/zh/sql-reference/aggregate-functions/reference) - [Русский](https://clickhouse.com/docs/ru/sql-reference/aggregate-functions/reference) - [한국어](https://clickhouse.com/docs/ko/sql-reference/aggregate-functions/reference) [Skip to main content](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference#__docusaurus_skipToContent_fallback) [![ClickHouse](https://clickhouse.com/docs/img/ch_logo_docs.svg)](https://clickhouse.com/) - [Products](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [ClickHouse Cloud Best way to use ClickHouse. Available on AWS, GCP, and Azure.](https://clickhouse.com/cloud) - [BYOC (Bring Your Own Cloud) The fully managed ClickHouse Cloud service, Can be deployed in your AWS account.](https://clickhouse.com/cloud/bring-your-own-cloud) - [ClickHouse Set up a database with open-source ClickHouse. ClickHouse](https://clickhouse.com/clickhouse) - [Discover more than 100 integrations.](https://clickhouse.com/integrations) [Discover more than 100 integrations.](https://clickhouse.com/integrations) - [Use cases](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [Real-time analytics](https://clickhouse.com/use-cases/real-time-analytics) - [Machine Learning & Generative AI](https://clickhouse.com/use-cases/machine-learning-and-data-science) - [Business Intelligence](https://clickhouse.com/use-cases/data-warehousing) - [Logs, Events, Traces](https://clickhouse.com/use-cases/observability) - [All use cases](https://clickhouse.com/use-cases) [All use cases](https://clickhouse.com/use-cases) - [Documentation](https://clickhouse.com/docs) - [Resources](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [User stories](https://clickhouse.com/user-stories) - [Blog](https://clickhouse.com/blog) - [Events](https://clickhouse.com/company/events) - [Learning and certification](https://clickhouse.com/learn) - [Comparison](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [BigQuery](https://clickhouse.com/comparison/bigquery) - [PostgreSQL](https://clickhouse.com/comparison/postgresql) - [Redshift](https://clickhouse.com/comparison/redshift) - [Rockset](https://clickhouse.com/comparison/rockset) - [Snowflake](https://clickhouse.com/comparison/snowflake) - [Video](https://clickhouse.com/videos) - [Demo](https://clickhouse.com/demos) - [Pricing](https://clickhouse.com/pricing) - [Contact](https://clickhouse.com/company/contact?loc=nav) [46\.7k](https://github.com/ClickHouse/ClickHouse?utm_source=clickhouse&utm_medium=website&utm_campaign=website-nav) [Search`Ctrl``K`](https://clickhouse.com/docs/search) [Sign in](https://console.clickhouse.cloud/signIn?loc=docs-nav-signIn-cta&glxid=f3d9dfaf-92f3-4b93-8269-13da799d3f21&pagePath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&origPath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&utm_ga=GA1.1.1011770293.1775246985) [Get started](https://console.clickhouse.cloud/signUp?loc=docs-nav-signUp-cta&glxid=f3d9dfaf-92f3-4b93-8269-13da799d3f21&pagePath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&origPath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&utm_ga=GA1.1.1011770293.1775246985) [Get started](https://clickhouse.com/docs/introduction-clickhouse) [Cloud](https://clickhouse.com/docs/cloud/overview) [Manage data](https://clickhouse.com/docs/updating-data) [Server admin](https://clickhouse.com/docs/guides/manage-and-deploy-index) [Reference](https://clickhouse.com/docs/sql-reference) [Integrations](https://clickhouse.com/docs/integrations) [ClickStack](https://clickhouse.com/docs/use-cases/observability/clickstack/overview) [chDB](https://clickhouse.com/docs/chdb) [About](https://clickhouse.com/docs/about) [Knowledge Base](https://clickhouse.com/docs/knowledgebase) [English](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [English](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [日本語](https://clickhouse.com/docs/jp/sql-reference/aggregate-functions/reference) - [中文](https://clickhouse.com/docs/zh/sql-reference/aggregate-functions/reference) - [Русский](https://clickhouse.com/docs/ru/sql-reference/aggregate-functions/reference) - [한국어](https://clickhouse.com/docs/ko/sql-reference/aggregate-functions/reference) [Search`Ctrl``K`](https://clickhouse.com/docs/search) - [Introduction](https://clickhouse.com/docs/sql-reference) - [Syntax](https://clickhouse.com/docs/sql-reference/syntax) - [Input and Output Formats](https://clickhouse.com/docs/sql-reference/formats) - [Data types](https://clickhouse.com/docs/sql-reference/data-types) - [Statements](https://clickhouse.com/docs/sql-reference/statements) - [Operators](https://clickhouse.com/docs/sql-reference/operators) - [Engines](https://clickhouse.com/docs/engines) - [Database Engines](https://clickhouse.com/docs/engines/database-engines) - [Table Engines](https://clickhouse.com/docs/engines/table-engines) - [Functions](https://clickhouse.com/docs/sql-reference/functions) - [Regular functions](https://clickhouse.com/docs/sql-reference/functions/regular-functions) - [Aggregate functions](https://clickhouse.com/docs/sql-reference/aggregate-functions) - [Aggregate Functions](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [aggThrow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/aggthrow) - [analysisOfVariance](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/analysis_of_variance) - [any](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/any) - [anyHeavy](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/anyheavy) - [anyLast](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/anylast) - [approx\_top\_k](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/approxtopk) - [approx\_top\_sum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/approxtopsum) - [argAndMax](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argandmax) - [argAndMin](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argandmin) - [argMax](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argmax) - [argMin](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argmin) - [avg](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/avg) - [avgWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/avgweighted) - [boundingRatio](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/boundingRatio) - [categoricalInformationValue](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/categoricalinformationvalue) - [contingency](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/contingency) - [corr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/corr) - [corrMatrix](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/corrmatrix) - [corrStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/corrstable) - [count](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/count) - [covarPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarpop) - [covarPopMatrix](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarpopmatrix) - [covarPopStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarpopstable) - [covarSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarsamp) - [covarSampMatrix](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarsampmatrix) - [covarSampStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarsampstable) - [cramersV](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/cramersv) - [cramersVBiasCorrected](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/cramersvbiascorrected) - [deltaSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/deltasum) - [deltaSumTimestamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/deltasumtimestamp) - [distinctDynamicTypes](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/distinctdynamictypes) - [distinctJSONPaths](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/distinctjsonpaths) - [distinctJSONPathsAndTypes](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/distinctJSONPathsAndTypes) - [entropy](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/entropy) - [estimateCompressionRatio](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/estimateCompressionRatio) - [exponentialMovingAverage](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialMovingAverage) - [exponentialTimeDecayedAvg](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedAvg) - [exponentialTimeDecayedCount](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedCount) - [exponentialTimeDecayedMax](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedMax) - [exponentialTimeDecayedSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedSum) - [first\_value](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/first_value) - [flameGraph](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/flame_graph) - [groupArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparray) - [groupArrayArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparrayarray) - [groupArrayInsertAt](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparrayinsertat) - [groupArrayIntersect](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparrayintersect) - [groupArrayLast](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraylast) - [groupArrayMovingAvg](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraymovingavg) - [groupArrayMovingSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraymovingsum) - [groupArraySample](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraysample) - [groupArraySorted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraysorted) - [groupBitAnd](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitand) - [groupBitOr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitor) - [groupBitXor](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitxor) - [groupBitmap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmap) - [groupBitmapAnd](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmapand) - [groupBitmapOr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmapor) - [groupBitmapXor](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmapxor) - [groupConcat](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupconcat) - [groupUniqArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupuniqarray) - [intervalLengthSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/intervalLengthSum) - [kolmogorovSmirnovTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/kolmogorovsmirnovtest) - [kurtPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/kurtpop) - [kurtSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/kurtsamp) - [largestTriangleThreeBuckets](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/largestTriangleThreeBuckets) - [last\_value](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/last_value) - [mannWhitneyUTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/mannwhitneyutest) - [max](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/max) - [maxIntersections](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/maxintersections) - [maxIntersectionsPosition](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/maxintersectionsposition) - [maxMap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/maxmap) - [meanZTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/meanztest) - [median](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/median) - [min](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/min) - [minMap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/minmap) - [quantile](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantile) - [quantileBFloat16](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilebfloat16) - [quantileDD](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileddsketch) - [quantileDeterministic](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiledeterministic) - [quantileExact Functions](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileexact) - [quantileExactExclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactExclusive) - [quantileExactHigh](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactHigh) - [quantileExactInclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactInclusive) - [quantileExactLow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactLow) - [quantileExactWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileexactweighted) - [quantileExactWeightedInterpolated](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactWeightedInterpolated) - [quantileGK](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileGK) - [quantileInterpolatedWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileInterpolatedWeighted) - [quantilePrometheusHistogram](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilePrometheusHistogram) - [quantileTDigest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletdigest) - [quantileTDigestWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletdigestweighted) - [quantileTiming](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletiming) - [quantileTimingWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletimingweighted) - [quantiles Functions](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiles) - [quantilesExactExclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilesExactExclusive) - [quantilesExactInclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilesExactInclusive) - [quantilesGK](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilesGK) - [quantilesTimingWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilestimingweighted) - [rankCorr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/rankCorr) - [simpleLinearRegression](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/simplelinearregression) - [singleValueOrNull](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/singlevalueornull) - [skewPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/skewpop) - [skewSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/skewsamp) - [sparkbar](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sparkbar) - [stddevPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevpop) - [stddevPopStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevpopstable) - [stddevSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevsamp) - [stddevSampStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevsampstable) - [stochasticLinearRegression](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stochasticlinearregression) - [stochasticLogisticRegression](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stochasticlogisticregression) - [studentTTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/studentttest) - [studentTTestOneSample](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/studentttestonesample) - [sum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sum) - [sumCount](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sumcount) - [sumKahan](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sumkahan) - [sumMapWithOverflow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/summapwithoverflow) - [sumMap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/summap) - [sumWithOverflow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sumwithoverflow) - [theilsU](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/theilsu) - [timeSeriesChangesToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesChangesToGrid) - [timeSeriesDeltaToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesDeltaToGrid) - [timeSeriesDerivToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesDerivToGrid) - [timeSeriesGroupArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesGroupArray) - [timeSeriesInstantDeltaToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesInstantDeltaToGrid) - [timeSeriesInstantRateToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesInstantRateToGrid) - [timeSeriesLastTwoSamples](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesLastTwoSamples) - [timeSeriesPredictLinearToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesPredictLinearToGrid) - [timeSeriesRateToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesRateToGrid) - [timeSeriesResampleToGridWithStaleness](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesResampleToGridWithStaleness) - [timeSeriesResetsToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesResetsToGrid) - [topK](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/topk) - [topKWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/topkweighted) - [uniq](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniq) - [uniqCombined](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqcombined) - [uniqCombined64](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqcombined64) - [uniqExact](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqexact) - [uniqHLL12](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqhll12) - [uniqTheta](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqthetasketch) - [varPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varPop) - [varPopStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varpopstable) - [varSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varSamp) - [varSampStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varsampstable) - [welchTTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/welchttest) - [Combinators](https://clickhouse.com/docs/sql-reference/aggregate-functions/combinators) - [Parametric](https://clickhouse.com/docs/sql-reference/aggregate-functions/parametric-functions) - [GROUPING](https://clickhouse.com/docs/sql-reference/aggregate-functions/grouping_function) - [Combinator examples](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference) - [Table functions](https://clickhouse.com/docs/sql-reference/table-functions) - [Window functions](https://clickhouse.com/docs/sql-reference/window-functions) - [Formats](https://clickhouse.com/docs/interfaces/formats) - [Data Lakes](https://clickhouse.com/docs/sql-reference/datalakes) - [Functions](https://clickhouse.com/docs/sql-reference/functions) - [Aggregate functions](https://clickhouse.com/docs/sql-reference/aggregate-functions) - Aggregate Functions [Edit this page](https://github.com/ClickHouse/ClickHouse/tree/master/docs/en/sql-reference/aggregate-functions/reference/index.md) # Aggregate functions ClickHouse supports all standard SQL aggregate functions ([sum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sum), [avg](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/avg), [min](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/min), [max](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/max), [count](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/count)), as well as a wide range of other aggregate functions. | Page | Description | |---|---| | [aggThrow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/aggthrow) | This function can be used for the purpose of testing exception safety. It will throw an exception on creation with the specified probability. | | [analysisOfVariance](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/analysis_of_variance) | Provides a statistical test for one-way analysis of variance (ANOVA test). It is a test over several groups of normally distributed observations to find out whether all groups have the same mean or not. | | [any](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/any) | Selects the first encountered value of a column. | | [anyHeavy](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/anyheavy) | Selects a frequently occurring value using the heavy hitters algorithm. If there is a value that occurs more than in half the cases in each of the query execution threads, this value is returned. Normally, the result is nondeterministic. | | [anyLast](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/anylast) | Selects the last encountered value of a column. | | [approx\_top\_k](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/approxtopk) | Returns an array of the approximately most frequent values and their counts in the specified column. | | [approx\_top\_sum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/approxtopsum) | Returns an array of the approximately most frequent values and their counts in the specified column. | | [argAndMax](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argandmax) | Calculates the `arg` and `val` value for a maximum `val` value. If there are multiple rows with equal `val` being the maximum, which of the associated `arg` and `val` is returned is not deterministic. | | [argAndMin](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argandmin) | Calculates the `arg` and `val` value for a minimum `val` value. If there are multiple rows with equal `val` being the minimum, which of the associated `arg` and `val` is returned is not deterministic. | | [argMax](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argmax) | Calculates the `arg` value for a maximum `val` value. | | [argMin](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/argmin) | Calculates the `arg` value for a minimum `val` value. If there are multiple rows with equal `val` being the maximum, which of the associated `arg` is returned is not deterministic. | | [avg](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/avg) | Calculates the arithmetic mean. | | [avgWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/avgweighted) | Calculates the weighted arithmetic mean. | | [boundingRatio](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/boundingRatio) | Aggregate function that calculates the slope between the leftmost and rightmost points across a group of values. | | [categoricalInformationValue](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/categoricalinformationvalue) | Calculates the value of `(P(tag = 1) - P(tag = 0))(log(P(tag = 1)) - log(P(tag = 0)))` for each category. | | [contingency](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/contingency) | The `contingency` function calculates the contingency coefficient, a value that measures the association between two columns in a table. The computation is similar to the `cramersV` function but with a different denominator in the square root. | | [corr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/corr) | Calculates the Pearson correlation coefficient. | | [corrMatrix](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/corrmatrix) | Computes the correlation matrix over N variables. | | [corrStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/corrstable) | Calculates the Pearson correlation coefficient, but uses a numerically stable algorithm. | | [count](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/count) | Counts the number of rows or not-NULL values. | | [covarPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarpop) | Calculates the population covariance | | [covarPopMatrix](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarpopmatrix) | Returns the population covariance matrix over N variables. | | [covarPopStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarpopstable) | Calculates the value of the population covariance | | [covarSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarsamp) | Calculates the value of `Σ((x - x̅)(y - y̅)) / (n - 1)` | | [covarSampMatrix](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarsampmatrix) | Returns the sample covariance matrix over N variables. | | [covarSampStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/covarsampstable) | Similar to covarSamp but works slower while providing a lower computational error. | | [cramersV](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/cramersv) | The result of the `cramersV` function ranges from 0 (corresponding to no association between the variables) to 1 and can reach 1 only when each value is completely determined by the other. It may be viewed as the association between two variables as a percentage of their maximum possible variation. | | [cramersVBiasCorrected](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/cramersvbiascorrected) | Calculates Cramer's V, but uses a bias correction. | | [deltaSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/deltasum) | Sums the arithmetic difference between consecutive rows. | | [deltaSumTimestamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/deltasumtimestamp) | Adds the difference between consecutive rows. If the difference is negative, it is ignored. | | [distinctDynamicTypes](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/distinctdynamictypes) | Calculates the list of distinct data types stored in Dynamic column. | | [distinctJSONPaths](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/distinctjsonpaths) | Calculates a list of distinct paths stored in a JSON column. | | [distinctJSONPathsAndTypes](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/distinctJSONPathsAndTypes) | Calculates the list of distinct paths and their types stored in JSON | | [entropy](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/entropy) | Calculates Shannon entropy of for a column of values. | | [estimateCompressionRatio](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/estimateCompressionRatio) | Estimates the compression ratio of a given column without compressing it. | | [exponentialMovingAverage](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialMovingAverage) | Calculates the exponential moving average of values for the determined time. | | [exponentialTimeDecayedAvg](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedAvg) | Returns the exponentially smoothed weighted moving average of values of a time series at point `t` in time. | | [exponentialTimeDecayedCount](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedCount) | Returns the cumulative exponential decay over a time series at the index `t` in time. | | [exponentialTimeDecayedMax](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedMax) | Returns the maximum of the computed exponentially smoothed moving average at index `t` in time with that at `t-1`. | | [exponentialTimeDecayedSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/exponentialTimeDecayedSum) | Returns the sum of exponentially smoothed moving average values of a time series at the index `t` in time. | | [first\_value](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/first_value) | It is an alias for any but it was introduced for compatibility with Window Functions, where sometimes it is necessary to process `NULL` values (by default all ClickHouse aggregate functions ignore NULL values). | | [flameGraph](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/flame_graph) | Aggregate function which builds a flamegraph using the list of stacktraces. | | [groupArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparray) | Creates an array of argument values. Values can be added to the array in any (indeterminate) order. | | [groupArrayArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparrayarray) | Aggregates arrays into a larger array of those arrays. | | [groupArrayInsertAt](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparrayinsertat) | Inserts a value into the array at the specified position. | | [groupArrayIntersect](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparrayintersect) | Return an intersection of given arrays (Return all items of arrays, that are in all given arrays). | | [groupArrayLast](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraylast) | Creates an array of the last argument values. | | [groupArrayMovingAvg](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraymovingavg) | Calculates the moving average of input values. | | [groupArrayMovingSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraymovingsum) | Calculates the moving sum of input values. | | [groupArraySample](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraysample) | Creates an array of sample argument values. The size of the resulting array is limited to `max_size` elements. Argument values are selected and added to the array randomly. | | [groupArraySorted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/grouparraysorted) | Returns an array with the first N items in ascending order. | | [groupBitAnd](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitand) | Applies bit-wise `AND` for series of numbers. | | [groupBitmap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmap) | Bitmap or Aggregate calculations from a unsigned integer column, return cardinality of type UInt64, if add suffix -State, then return a bitmap object | | [groupBitmapAnd](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmapand) | Calculations the AND of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return a bitmap object. | | [groupBitmapOr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmapor) | Calculations the OR of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return a bitmap object. This is equivalent to `groupBitmapMerge`. | | [groupBitmapXor](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitmapxor) | Calculates the XOR of a bitmap column, and returns the cardinality of type UInt64, if used with suffix -State, then it returns a bitmap object | | [groupBitOr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitor) | Applies bit-wise `OR` to a series of numbers. | | [groupBitXor](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupbitxor) | Applies bit-wise `XOR` for series of numbers. | | [groupConcat](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupconcat) | Calculates a concatenated string from a group of strings, optionally separated by a delimiter, and optionally limited by a maximum number of elements. | | [groupUniqArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/groupuniqarray) | Creates an array from different argument values. | | [intervalLengthSum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/intervalLengthSum) | Calculates the total length of union of all ranges (segments on numeric axis). | | [kolmogorovSmirnovTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/kolmogorovsmirnovtest) | Applies Kolmogorov-Smirnov's test to samples from two populations. | | [kurtPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/kurtpop) | Computes the kurtosis of a sequence. | | [kurtSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/kurtsamp) | Computes the sample kurtosis of a sequence. | | [largestTriangleThreeBuckets](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/largestTriangleThreeBuckets) | Applies the Largest-Triangle-Three-Buckets algorithm to the input data. | | [last\_value](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/last_value) | Selects the last encountered value, similar to `anyLast`, but could accept NULL. | | [mannWhitneyUTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/mannwhitneyutest) | Applies the Mann-Whitney rank test to samples from two populations. | | [max](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/max) | Aggregate function that calculates the maximum across a group of values. | | [maxIntersections](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/maxintersections) | Aggregate function that calculates the maximum number of times that a group of intervals intersects each other (if all the intervals intersect at least once). | | [maxIntersectionsPosition](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/maxintersectionsposition) | Aggregate function that calculates the positions of the occurrences of the maxIntersections function. | | [maxMap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/maxmap) | Calculates the maximum from `value` array according to the keys specified in the `key` array. | | [meanZTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/meanztest) | Applies mean z-test to samples from two populations. | | [median](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/median) | The `median*` functions are the aliases for the corresponding `quantile*` functions. They calculate median of a numeric data sample. | | [min](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/min) | Aggregate function that calculates the minimum across a group of values. | | [minMap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/minmap) | Calculates the minimum from `value` array according to the keys specified in the `key` array. | | [quantile](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantile) | Computes an approximate quantile of a numeric data sequence. | | [quantileBFloat16](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilebfloat16) | Computes an approximate quantile of a sample consisting of bfloat16 numbers. | | [quantileDD](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileddsketch) | Computes an approximate quantile of a sample with relative-error guarantees. | | [quantileDeterministic](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiledeterministic) | Computes an approximate quantile of a numeric data sequence. | | [quantileExact Functions](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileexact) | quantileExact, quantileExactLow, quantileExactHigh, quantileExactExclusive, quantileExactInclusive functions | | [quantileExactExclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactExclusive) | Exactly computes the quantile of a numeric data sequence. | | [quantileExactHigh](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactHigh) | Similar to quantileExact, this computes the exact quantile of a numeric data sequence. | | [quantileExactInclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactInclusive) | Exactly computes the quantile of a numeric data sequence. | | [quantileExactLow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactLow) | Similar to quantileExact, this computes the exact [quantile](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence. | | [quantileExactWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileexactweighted) | Exactly computes the quantile of a numeric data sequence, taking into account the weight of each element. | | [quantileExactWeightedInterpolated](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileExactWeightedInterpolated) | Computes quantile of a numeric data sequence using linear interpolation, taking into account the weight of each element. | | [quantileGK](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileGK) | Computes the quantile of a numeric data sequence using the Greenwald-Khanna algorithm. | | [quantileInterpolatedWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantileInterpolatedWeighted) | Computes quantile of a numeric data sequence using linear interpolation, taking into account the weight of each element. | | [quantilePrometheusHistogram](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilePrometheusHistogram) | Computes quantile of a histogram using linear interpolation. | | [quantiles Functions](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiles) | quantiles, quantilesExactExclusive, quantilesExactInclusive, quantilesGK | | [quantilesExactExclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilesExactExclusive) | Exactly computes the quantiles of a numeric data sequence. | | [quantilesExactInclusive](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilesExactInclusive) | Exactly computes the quantiles of a numeric data sequence. | | [quantilesGK](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilesGK) | quantilesGK works similarly to quantileGK but allows us to calculate quantities at different levels simultaneously and returns an array. | | [quantilesTimingWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantilestimingweighted) | With the determined precision computes the quantile of a numeric data sequence according to the weight of each sequence member. | | [quantileTDigest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletdigest) | Computes an approximate quantile of a numeric data sequence using the t-digest algorithm. | | [quantileTDigestWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletdigestweighted) | Computes an approximate quantile of a numeric data sequence using the t-digest algorithm. | | [quantileTiming](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletiming) | With the determined precision computes the quantile of a numeric data sequence. | | [quantileTimingWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/quantiletimingweighted) | With the determined precision computes the quantile of a numeric data sequence according to the weight of each sequence member. | | [rankCorr](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/rankCorr) | Computes a rank correlation coefficient. | | [simpleLinearRegression](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/simplelinearregression) | Performs simple (unidimensional) linear regression. | | [singleValueOrNull](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/singlevalueornull) | The aggregate function `singleValueOrNull` is used to implement subquery operators, such as `x = ALL (SELECT ...)`. It checks if there is only one unique non-NULL value in the data. | | [skewPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/skewpop) | Computes the skewness of a sequence. | | [skewSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/skewsamp) | Computes the sample skewness of a sequence. | | [sparkbar](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sparkbar) | The function plots a frequency histogram for values `x` and the repetition rate `y` of these values over the interval `[min_x, max_x]`. | | [stddevPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevpop) | The result is equal to the square root of varPop. | | [stddevPopStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevpopstable) | The result is equal to the square root of varPop. Unlike stddevPop, this function uses a numerically stable algorithm. | | [stddevSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevsamp) | The result is equal to the square root of varSamp | | [stddevSampStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stddevsampstable) | The result is equal to the square root of varSamp. Unlike this function uses a numerically stable algorithm. | | [stochasticLinearRegression](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stochasticlinearregression) | This function implements stochastic linear regression. It supports custom parameters for learning rate, L2 regularization coefficient, mini-batch size, and has a few methods for updating weights (Adam, simple SGD, Momentum, Nesterov.) | | [stochasticLogisticRegression](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/stochasticlogisticregression) | This function implements stochastic logistic regression. It can be used for binary classification problem, supports the same custom parameters as stochasticLinearRegression and works the same way. | | [studentTTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/studentttest) | Applies the student t-test to samples from two populations. | | [studentTTestOneSample](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/studentttestonesample) | Applies the one-sample Student t-test to a sample and a known population mean. | | [sum](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sum) | Calculates the sum. Only works for numbers. | | [sumCount](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sumcount) | Calculates the sum of the numbers and counts the number of rows at the same time. The function is used by ClickHouse query optimizer: if there are multiple `sum`, `count` or `avg` functions in a query, they can be replaced to single `sumCount` function to reuse the calculations. The function is rarely needed to use explicitly. | | [sumKahan](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sumkahan) | Calculates the sum of the numbers with Kahan compensated summation algorithm | | [sumMap](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/summap) | Totals one or more `value` arrays according to the keys specified in the `key` array. Returns a tuple of arrays: keys in sorted order, followed by values summed for the corresponding keys without overflow. | | [sumMapWithOverflow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/summapwithoverflow) | Totals a `value` array according to the keys specified in the `key` array. Returns a tuple of two arrays: keys in sorted order, and values summed for the corresponding keys. Differs from the sumMap function in that it does summation with overflow. | | [sumWithOverflow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/sumwithoverflow) | Computes the sum of the numbers, using the same data type for the result as for the input parameters. If the sum exceeds the maximum value for this data type, it is calculated with overflow. | | [theilsU](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/theilsu) | The `theilsU` function calculates Theils' U uncertainty coefficient, a value that measures the association between two columns in a table. | | [timeSeriesChangesToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesChangesToGrid) | Aggregate function that calculates PromQL-like changes over time series data on the specified grid. | | [timeSeriesDeltaToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesDeltaToGrid) | Aggregate function that calculates PromQL-like delta over time series data on the specified grid. | | [timeSeriesDerivToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesDerivToGrid) | Aggregate function that calculates PromQL-like derivative over time series data on the specified grid. | | [timeSeriesGroupArray](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesGroupArray) | Sorts time series by timestamp in ascending order. | | [timeSeriesInstantDeltaToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesInstantDeltaToGrid) | Aggregate function that calculates PromQL-like idelta over time series data on the specified grid. | | [timeSeriesInstantRateToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesInstantRateToGrid) | Aggregate function that calculates PromQL-like irate over time series data on the specified grid. | | [timeSeriesLastTwoSamples](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesLastTwoSamples) | Aggregate function for re-sampling time series data for PromQL-like irate and idelta calculation | | [timeSeriesPredictLinearToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesPredictLinearToGrid) | Aggregate function that calculates PromQL-like linear prediction over time series data on the specified grid. | | [timeSeriesRateToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesRateToGrid) | Aggregate function that calculates PromQL-like rate over time series data on the specified grid. | | [timeSeriesResampleToGridWithStaleness](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesResampleToGridWithStaleness) | Aggregate function that re-samples time series data to the specified grid. | | [timeSeriesResetsToGrid](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/timeSeriesResetsToGrid) | Aggregate function that calculates PromQL-like resets over time series data on the specified grid. | | [topK](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/topk) | Returns an array of the approximately most frequent values in the specified column. The resulting array is sorted in descending order of approximate frequency of values (not by the values themselves). | | [topKWeighted](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/topkweighted) | Returns an array of the approximately most frequent values in the specified column. The resulting array is sorted in descending order of approximate frequency of values (not by the values themselves). Additionally, the weight of the value is taken into account. | | [uniq](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniq) | Calculates the approximate number of different values of the argument. | | [uniqCombined](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqcombined) | Calculates the approximate number of different argument values. | | [uniqCombined64](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqcombined64) | Calculates the approximate number of different argument values. It is the same as uniqCombined, but uses a 64-bit hash for all data types rather than just for the String data type. | | [uniqExact](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqexact) | Calculates the exact number of different argument values. | | [uniqHLL12](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqhll12) | Calculates the approximate number of different argument values, using the HyperLogLog algorithm. | | [uniqTheta](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/uniqthetasketch) | Calculates the approximate number of different argument values, using the Theta Sketch Framework. | | [varPop](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varPop) | Calculates the population variance. | | [varPopStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varpopstable) | Returns the population variance. Unlike varPop , this function uses a numerically stable algorithm. It works slower but provides a lower computational error. | | [varSamp](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varSamp) | Calculate the sample variance of a data set. | | [varSampStable](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/varsampstable) | Calculate the sample variance of a data set. Unlike `varSamp` , this function uses a numerically stable algorithm. It works slower but provides a lower computational error. | | [welchTTest](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/welchttest) | Applies Welch's t-test to samples from two populations. | [Previous Aggregate Functions](https://clickhouse.com/docs/sql-reference/aggregate-functions) [Next aggThrow](https://clickhouse.com/docs/sql-reference/aggregate-functions/reference/aggthrow) Was this page helpful? ###### Try ClickHouse Cloud for FREE Separation of storage and compute, automatic scaling, built-in SQL console, and lots more. \$300 in free credits when signing up. [Try it for Free](https://console.clickhouse.cloud/signUp?loc=doc-card-banner&glxid=f3d9dfaf-92f3-4b93-8269-13da799d3f21&pagePath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&origPath=%2Fdocs%2Fsql-reference%2Faggregate-functions%2Freference&utm_ga=GA1.1.1011770293.1775246985) © 2016–2026 ClickHouse, Inc. [Trademark](https://clickhouse.com/legal/trademark-policy)·[Privacy](https://clickhouse.com/legal/privacy-policy)·[Security](https://trust.clickhouse.com/)·[Terms of Service](https://clickhouse.com/legal/agreements/terms-of-service) ![](https://static.scarf.sh/a.png?x-pxid=e6377503-591b-4886-9398-e69c7fee0b91) © 2016–2026 ClickHouse, Inc. [Trademark](https://clickhouse.com/legal/trademark-policy)·[Privacy](https://clickhouse.com/legal/privacy-policy)·[Security](https://trust.clickhouse.com/)·[Terms of Service](https://clickhouse.com/legal/agreements/terms-of-service) ![](https://static.scarf.sh/a.png?x-pxid=e6377503-591b-4886-9398-e69c7fee0b91) [![ClickHouse](https://clickhouse.com/docs/img/ch_logo_docs.svg)](https://clickhouse.com/) EN - Get started▼ - Cloud▼ - Manage data▼ - Server admin▼ - Reference▼ - Integrations▼ - ClickStack▼ - chDB▼ - About▼ [![ClickHouse](https://clickhouse.com/docs/img/ch_logo_docs.svg)](https://clickhouse.com/) EN main-menu - Introduction▼ - [Syntax](https://clickhouse.com/docs/sql-reference/syntax) - [Input and Output Formats](https://clickhouse.com/docs/sql-reference/formats) - Data types▼ - Statements▼ - Operators▼ - Engines▼ - Functions▼ - Formats▼ - [Data Lakes](https://clickhouse.com/docs/sql-reference/datalakes)
Readable Markdownnull
Shard89 (laksa)
Root Hash12633450985039531489
Unparsed URLcom,clickhouse!/docs/sql-reference/aggregate-functions/reference s443