Re: Optimizing CartoDB's JenksBins function

From: Andy Colson <andy(at)squeakycode(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimizing CartoDB's JenksBins function
Date: 2014-03-18 21:47:17
Message-ID: 5328BEE5.6050709@squeakycode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Edson Richter 2014-03-19 00:07:40 Re: Add column name to error message?
Previous Message Tom Lane 2014-03-18 20:44:54 Re: Add column name to error message?