News for hackers. Stuff that matters.
Re:Let Postgres Do the Work (2013) by herge on Saturday November 26, 2016 @03:51PM (#13045779)
Have you considered a hybrid approach, like doing the heavy lifting/querying/calculating in Postgres, but the final formatting of the report (something that might change often, or be very finicky to implement in pl/sql or in the db) is left to ruby?
Re:Let Postgres Do the Work (2013) by phereford on Saturday November 26, 2016 @03:54PM (#13045792)
That's exactly what we did. We return an anonymous table of records in Postgres that are then passed to ruby to render an excel file. The SQL query takes 27s on average. The ruby view generation is fast as well but I haven't profiled that part of the report.
Re:Let Postgres Do the Work (2013) by koolba on Saturday November 26, 2016 @04:45PM (#13046049)
> That's exactly what we did. We return an anonymous table of records in Postgres that are then passed to ruby to render an excel file. The SQL query takes 27s on average. The ruby view generation is fast as well but I haven't profiled that part of the report.

What's an "anonymous table of records"? Do you mean it's just a result set (i.e. query)?

Re:Let Postgres Do the Work (2013) by phereford on Saturday November 26, 2016 @04:49PM (#13046073)
Yea. It returns a table of rows, where the return columns are defined in the stored procedure. I may have used the wrong nomenclature. I was trying to differentiate between a table in a database schema versus one defined in a function.
Re:Let Postgres Do the Work (2013) by mst on Saturday November 26, 2016 @05:01PM (#13046142)
"The stored procedure returns a multi-row resultset via a SETOF[ROWTYPE] return value" might be a clearer description?
Re:Let Postgres Do the Work (2013) by phereford on Saturday November 26, 2016 @05:08PM (#13046172)
Thank you!!!!