Re: [HACKERS] Built-in binning functions

2014-09-09 Thread Tom Lane
Petr Jelinek writes: > On 07/09/14 21:09, Andres Freund wrote: >> On 2014-09-07 15:05:35 -0400, Tom Lane wrote: >>> I think the main remaining issue is that we don't have consensus on >>> the function name AFAICT. I'm okay with using width_bucket(), as >>> is done in the latest patch, but there w

Re: [HACKERS] Built-in binning functions

2014-09-07 Thread Petr Jelinek
On 07/09/14 21:09, Andres Freund wrote: On 2014-09-07 15:05:35 -0400, Tom Lane wrote: I think the main remaining issue is that we don't have consensus on the function name AFAICT. I'm okay with using width_bucket(), as is done in the latest patch, but there were objections ... Just reread tha

Re: [HACKERS] Built-in binning functions

2014-09-07 Thread Andres Freund
On 2014-09-07 15:05:35 -0400, Tom Lane wrote: > Andres Freund writes: > > Tom, are you planning to take this one? > > Yeah, I already looked at it once, so will take it. Cool. > I think the main remaining issue is that we don't have consensus on > the function name AFAICT. I'm okay with using

Re: [HACKERS] Built-in binning functions

2014-09-07 Thread Tom Lane
Andres Freund writes: > Tom, are you planning to take this one? Yeah, I already looked at it once, so will take it. I think the main remaining issue is that we don't have consensus on the function name AFAICT. I'm okay with using width_bucket(), as is done in the latest patch, but there were ob

Re: [HACKERS] Built-in binning functions

2014-09-07 Thread Andres Freund
On 2014-09-07 20:45:38 +0200, Pavel Stehule wrote: > 2014-09-07 14:29 GMT+02:00 Petr Jelinek : > > Ah yeah I forgot about those, fixed in attached patch. > ok > > It is ready for commit Tom, are you planning to take this one? Greetings, Andres Freund -- Andres Freund htt

Re: [HACKERS] Built-in binning functions

2014-09-07 Thread Pavel Stehule
2014-09-07 14:29 GMT+02:00 Petr Jelinek : > On 04/09/14 21:16, Pavel Stehule wrote: > >> >> I did a review of last patch >> > > Thanks > > >> I found only one issue - float8 path has no own test in regress tests. >> When this issue will be fixed, I will mark this patch as ready for commit >> >> >

Re: [HACKERS] Built-in binning functions

2014-09-07 Thread Petr Jelinek
On 04/09/14 21:16, Pavel Stehule wrote: I did a review of last patch Thanks I found only one issue - float8 path has no own test in regress tests. When this issue will be fixed, I will mark this patch as ready for commit Ah yeah I forgot about those, fixed in attached patch. -- Petr Je

Re: [HACKERS] Built-in binning functions

2014-09-04 Thread Pavel Stehule
Hi I did a review of last patch 1. There is no problem with patching 2. compilation and doc compilation without warnings and issues. 3. code is clean, respects Postgres coding rules and is well documented - it is slightly modified Tom's version with float8 optimization 4. The name with_bucket is

Re: [HACKERS] Built-in binning functions

2014-09-01 Thread Petr Jelinek
On 01/09/14 01:42, Tom Lane wrote: BTW, was there a reason for not noticing the case of exact match in the search loop, and falling out early? As it stands the code will reliably choose the leftmost match if there are multiple equal items in the search array, but do we care about such cases?

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread David Johnston
On Sun, Aug 31, 2014 at 7:48 PM, Tom Lane wrote: > David G Johnston writes: > > Since "bucket" is the 'verb' here (in this specific case meaning "lookup > the > > supplied value in the supplied bucket definition") and "width" is a > modifier > > (the bucket specification describes an equal-width

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Tom Lane
David G Johnston writes: > Since "bucket" is the 'verb' here (in this specific case meaning "lookup the > supplied value in the supplied bucket definition") and "width" is a modifier > (the bucket specification describes an equal-width structure) I suggest > "literal_bucket(val, array[])" such tha

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Tom Lane
Petr Jelinek writes: > On 31/08/14 22:33, Tom Lane wrote: >> Petr Jelinek writes: >>> The difference between my generic and Tom's generic is because Tom's is >>> slowed down by the deconstruct_array. >> Meh. It looked to me like your version would have O(N^2) performance >> problems from comput

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread David G Johnston
Simon Riggs wrote > width_bucket() seems to refer to an equal-width binning process. The > function being discussed here is a generic mechanism, the boundaries > of which could have been decided using equal-frequency or other > mechanisms. Using the word "width" in those contexts could be > confusi

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Petr Jelinek
On 31/08/14 22:33, Tom Lane wrote: Petr Jelinek writes: On 30/08/14 19:24, Tom Lane wrote: I wasn't terribly happy about that either. I still think we should reduce this to a single polymorphic function, as in the attached. I did try to write generic function very similar to what you wrote

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Simon Riggs
On 31 August 2014 20:44, Gavin Flower wrote: > On 01/09/14 06:00, Tom Lane wrote: >> >> Simon Riggs writes: >>> >>> Suggest discretize() as a much more informative name. The other names >>> will be overlooked by anybody that doesn't already know what to look >>> for. >> >> I did not like that ide

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Tom Lane
Petr Jelinek writes: > On 30/08/14 19:24, Tom Lane wrote: >> I wasn't terribly happy about that either. I still think we should >> reduce this to a single polymorphic function, as in the attached. > I did try to write generic function very similar to what you wrote but > discarded it because of

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Petr Jelinek
On 30/08/14 19:24, Tom Lane wrote: Pavel Stehule writes: 1. I am thinking so reduction to only numeric types is not necessary - although we can live without it - but there are lot of non numeric categories: chars, date, ... I wasn't terribly happy about that either. I still think we should r

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Gavin Flower
On 01/09/14 06:00, Tom Lane wrote: Simon Riggs writes: Suggest discretize() as a much more informative name. The other names will be overlooked by anybody that doesn't already know what to look for. I did not like that idea to begin with, but it's growing more attractive. In particular, I thin

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Tom Lane
Simon Riggs writes: > Suggest discretize() as a much more informative name. The other names > will be overlooked by anybody that doesn't already know what to look > for. I did not like that idea to begin with, but it's growing more attractive. In particular, I think it would be unique enough that

Re: [HACKERS] Built-in binning functions

2014-08-31 Thread Simon Riggs
On 30 August 2014 18:24, Tom Lane wrote: >> 3. I am thinking about name - I don't think so varwidth_bucket is correct >> -- in relation to name "width_bucket" ... what about "range_bucket" or >> "scope_bucket" ? > > Neither of those seem like improvements from here. I agree with the > objections

Re: [HACKERS] Built-in binning functions

2014-08-30 Thread Tom Lane
Pavel Stehule writes: > 1. I am thinking so reduction to only numeric types is not necessary - > although we can live without it - but there are lot of non numeric > categories: chars, date, ... I wasn't terribly happy about that either. I still think we should reduce this to a single polymorphi

Re: [HACKERS] Built-in binning functions

2014-08-29 Thread Pavel Stehule
Hi I am looking to your last patch and I have a few questions, notes 1. I am thinking so reduction to only numeric types is not necessary - although we can live without it - but there are lot of non numeric categories: chars, date, ... 2. Still I strongly afraid about used searching method - the

Re: [HACKERS] Built-in binning functions

2014-08-25 Thread Petr Jelinek
Hi, I finally had some time to get back to this. I attached version3 of the patch which "fixes" Tom's complaint about int8 version by removing the int8 version as it does not seem necessary (the float8 can handle integers just fine). This patch now basically has just one optimized function f

Re: [HACKERS] Built-in binning functions

2014-07-20 Thread Simon Riggs
On 16 July 2014 20:35, Pavel Stehule wrote: > > > > 2014-07-16 10:04 GMT+02:00 Petr Jelinek : > >> On 08/07/14 02:14, Tom Lane wrote: >>> >>> Petr Jelinek writes: here is a patch implementing varwidth_bucket (naming is up for discussion) function which does binning with variable bu

Re: [HACKERS] Built-in binning functions

2014-07-18 Thread Petr Jelinek
On 08/07/14 02:14, Tom Lane wrote: Also, the set of functions provided still needs more thought, because the resolution of overloaded functions doesn't really work as nicely as all that. I am honestly considering just removing special case for int8 for now, the sql standard width_bucket has on

Re: [HACKERS] Built-in binning functions

2014-07-18 Thread Petr Jelinek
On 16/07/14 21:35, Pavel Stehule wrote: The performance difference is about 20% (+/- few depending on the array size), I don't know if that's bad enough to warrant type-specific implementation. I personally don't know how to make the generic implementation much faster than it is n

Re: [HACKERS] Built-in binning functions

2014-07-16 Thread Pavel Stehule
2014-07-16 10:04 GMT+02:00 Petr Jelinek : > On 08/07/14 02:14, Tom Lane wrote: > >> Petr Jelinek writes: >> >>> here is a patch implementing varwidth_bucket (naming is up for >>> discussion) function which does binning with variable bucket width. >>> >> >> I didn't see any discussion of the namin

Re: [HACKERS] Built-in binning functions

2014-07-16 Thread Petr Jelinek
On 08/07/14 02:14, Tom Lane wrote: Petr Jelinek writes: here is a patch implementing varwidth_bucket (naming is up for discussion) function which does binning with variable bucket width. I didn't see any discussion of the naming question in this thread. I'd like to propose that it should be j

Re: [HACKERS] Built-in binning functions

2014-07-07 Thread Tom Lane
Petr Jelinek writes: > here is a patch implementing varwidth_bucket (naming is up for > discussion) function which does binning with variable bucket width. I didn't see any discussion of the naming question in this thread. I'd like to propose that it should be just "width_bucket()"; we can easil

Re: [HACKERS] Built-in binning functions

2014-06-17 Thread Petr Jelinek
On 17/06/14 16:15, Robert Haas wrote: On Fri, Jun 13, 2014 at 8:22 PM, Petr Jelinek wrote: 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 histo

Re: [HACKERS] Built-in binning functions

2014-06-17 Thread Robert Haas
On Fri, Jun 13, 2014 at 8:22 PM, Petr Jelinek wrote: > 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 wi

[HACKERS] Built-in binning functions

2014-06-13 Thread Petr Jelinek
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 var