Skip to main content
Since 1.3.0 Calculate the skewness from the values in a statistical aggregate. The skewness is the third statistical moment. It is a measure of asymmetry in a data distribution.
skewness(
  summary StatsSummary1D,
  [ method TEXT ]
) RETURNS DOUBLE PRECISION

Arguments

NameTypeDefaultRequiredDescription
summaryStatsSummary1D-The statistical aggregate produced by a stats_agg call
methodTEXTsample-The method used for calculating the skewness. The two options are population and sample, which can be abbreviated to pop or samp

Returns

ColumnTypeDescription
skewnessDOUBLE PRECISIONThe skewness of the values in the statistical aggregate

Samples

Calculate the skewness of a sample containing the integers from 0 to 100:
SELECT skewness(stats_agg(data))
  FROM generate_series(0, 100) data;
skewness_x
----------
0