Re: Optimizing CartoDB's JenksBins function - Mailing list pgsql-general

From Andy Colson
Subject Re: Optimizing CartoDB's JenksBins function
Date
Msg-id 5328BEE5.6050709@squeakycode.net
Whole thread Raw
In response to Re: Optimizing CartoDB's JenksBins function  (Joe Conway <mail@joeconway.com>)
List pgsql-general
On 3/18/2014 12:19 PM, Joe Conway wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 03/18/2014 09:42 AM, Seamus Abshere wrote:
>> Our friends from CartoDB [1] provide a beautiful Jenks Natural
>> Breaks function for Postgres [2]. It is quite computationally
>> intensive.
>>
>> Even if you don't know what Jenks is, do you see any
>> optimizations?
>
> Not exactly what you asked, but you might try PL/R with the R
> "classInt" package:
>
>    http://cran.at.r-project.org/web/packages/classInt/classInt.pdf
>
> HTH,
>
> Joe
>

Actually rewriting in any of the script languages might help.  plpgsql
is good a sql, but not so much with the math and string handling.  I'm
not sure about array's.

It looks like most of that code is playing with arrays and math.  I'd
bet pl/perl (or R, python, javascript, etc) would run much faster.

-Andy



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Add column name to error message?
Next
From: Edson Richter
Date:
Subject: Re: Add column name to error message?