| From: | Petr Jelinek <petr(at)2ndquadrant(dot)com> | 
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Built-in binning functions | 
| Date: | 2014-06-14 00:22:06 | 
| Message-ID: | 539B95AE.2010602@2ndquadrant.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hello,
here is a patch implementing varwidth_bucket (naming is up for 
discussion) function which does binning with variable bucket width. The 
use-cases are same as for width_bucket (=data analytics, mainly 
histograms), the difference is that width_bucket uses buckets of same 
width but the varwidth_bucket accepts an sorted array of right-bound 
thresholds to define the individual buckets.
Currently applications implement this with long CASE statements which 
are quite hard to read/maintain and are much slower than this 
implementation which uses binary search.
There are 3 actual functions, one generic and two faster versions for 
the int8 and float8 input that take advantage of the static width of 
those types.
The research leading to these results has received funding from the 
European Union's Seventh Framework Programme (FP7/2007-2013) under grant 
agreement n° 318633
-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services
| Attachment | Content-Type | Size | 
|---|---|---|
| binning_fns.patch | text/x-diff | 20.8 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Petr Jelinek | 2014-06-14 00:31:56 | Set new system identifier using pg_resetxlog | 
| Previous Message | Tom Lane | 2014-06-14 00:16:12 | Re: Something flaky in the "relfilenode mapping" infrastructure |