Permalink
Browse files

Fixed reference to 'median' function which was removed some time ago …

…(report by Sune Vuorela).
  • Loading branch information...
1 parent d00f312 commit 8e306dcfbab0f84755eecf26f870394393b36c58 @tvondra committed Jan 28, 2012
Showing with 15 additions and 19 deletions.
  1. +15 −19 README
View
34 README
@@ -1,20 +1,11 @@
Quantile aggregates
===================
This extension provides three simple aggregate functions to compute
-quantiles (http://en.wikipedia.org/wiki/Quantile). There are three
-aggregate functions available.
+quantiles (http://en.wikipedia.org/wiki/Quantile). There are two
+forms of aggregate functions available.
-1) median(p_value numeric)
---------------------------
-Computes 2-quantile, i.e. the 'middle' value. For example this
-
- SELECT median(i) FROM generate_series(1,1000) s(i);
-
-should return 500.
-
-
-2) quantile(p_value numeric, p_quantile float)
+1) quantile(p_value numeric, p_quantile float)
----------------------------------------------
Computes arbitrary quantile of the values - the quantile has to be
between 0 and 1. For example this should return 500 just like the
@@ -25,11 +16,12 @@ previous example
but you can choose arbitrary quantile.
-3) quantile(p_value numeric, p_quantiles float[])
+2) quantile(p_value numeric, p_quantiles float[])
-------------------------------------------------
-If you need multiple quantiles at the same time, you can use this
-function instead of the one described above. This version allows
-you to pass an array of quantiles and returns an array of values.
+If you need multiple quantiles at the same time (e.g. all four
+quartiles), you can use this function instead of the one described
+above. This version allows you to pass an array of quantiles and
+returns an array of values.
So if you need all three quartiles, you may do this
@@ -42,9 +34,13 @@ the simple quantile function like this
SELECT quantile(i, 0.25), quantile(i, 0.5), quantile(i, 0.75)
FROM generate_series(1,1000) s(i);
-the advantage is that the internal array is built only once (and
-not for each expression separately). If you're working with large
-data sets, this may be a significant advantage.
+the advantage is that the values are collected just once (into
+a single array), not for each expression separately. If you're
+working with large data sets, this may save a lot of time and
+memory (so it's a significant advantage).
+
+Just as in the first case, thre are three functions handling other
+basic numeric types, i.e. double, int (32-bit) and bigint (64-bit).
Installation

0 comments on commit 8e306dc

Please sign in to comment.