How can I calculate data for a boxplot (quartile, median) in a Rails application on Heroku? (Heroku uses Postgresql)

I am trying to compute the data needed to create a box, which means I need to figure out the 1st and 3rd quartiles along with the environment. I found some solutions for this in Postgresql, but they seem to depend on either PL / Python or PL / R, which seems like Heroku has no capability for their postgresql databases. Actually I ran "select lanname from pg_language"; and only returned "internal", "c" and "sql".

I also found some code to do this in pure ruby, but it seems somewhat inefficient to me.

I'm new to Box Plots, Postgresql and Ruby on Rails, so I'm open to suggestions on how I should handle this. It is possible to have a lot of data, so I am interested in performance, however if the solution turns out to be too complex I can just do it in ruby, and if my application is big enough to ensure that it gets my own Postgresql I can host where- something else.

* note: since I was only able to post one link, because I am a newbie, I decided to share a pastie with some relevant information

+2


a source to share


1 answer


Heroku does not give you superuser access to the PostgreSQL cluster, which is required to install any additional languages.



If possible, it is best to use the backend of the aggregation (in the database) for performance reasons. There are median aggregate implementations that don't need additional languages. When looking at PL / Python boxplot implementors , you need to be able to create the equivalent PL / pgSQL or PL / SQL.

+1


a source







All Articles