ColumnStore Distributed Aggregate Functions

You are viewing an old version of this article. View the current version here.

MariaDB ColumnStore supports the following aggregate functions, these can be used in the SELECT, HAVING, and ORDER BY clauses of the SQL statement.

FunctionDescription
AVG([DISTINCT] column)Average value of a numeric (INT variations, NUMERIC, DECIMAL) column
COUNT (*, [DISTINCT] column)The number of rows returned by a query or grouping. All datatypes are supported
MAX ([DISTINCT] column)The maximum value of a column. All datatypes are supported.
MIN ([DISTINCT] column)The maximum value of a column. All datatypes are supported.
STD(), STDDEV(), STDDEV_POP()The population standard deviation of a numeric (INT variations, NUMERIC, DECIMAL) column
STDDEV_SAMP()The sample standard deviation of a numeric (INT variations, NUMERIC, DECIMAL) column
SUM([DISTINCT] column)The sum of a numeric (INT variations, NUMERIC, DECIMAL) column
VARIANCE(), VAR_POP()The population standard variance of a numeric (INT variations, NUMERIC, DECIMAL) column
VAR_SAMP()The population standard variance of a numeric (INT variations, NUMERIC, DECIMAL) column

An example group by query using aggregate functions is:

select year(o_orderdate) order_year, 
avg(o_totalprice) avg_totalprice, 
max(o_totalprice) max_totalprice, 
count(*) order_count 
from orders 
group by order_year 
order by order_year;

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.