average(), average_y(), and average_x()

average(summary StatsSummary1D) RETURNS BIGINT
average_y(summary StatsSummary2D) RETURNS BIGINT
average_x(summary StatsSummary2D) RETURNS BIGINT

Get the average of the values contained in a statistical aggregate. In a two-dimensional stats_agg use the _y/ _x form to access the average of the dependent and independent variables.

For more information about statistical aggregate functions, see the hyperfunctions documentation.

Required arguments

summaryStatsSummary1D/StatsSummary2DThe already constructed data structure from a previous stats_agg call


average/average_y/average_xDOUBLE PRECISIONThe average of the values in the statistical aggregate

Sample usage

SELECT average(stats_agg(data))
FROM generate_series(0, 100) data;

Found an issue on this page?

Report an issue!

Related Content