Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?


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.


> 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)?


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.


"The stored procedure returns a multi-row resultset via a SETOF[ROWTYPE] return value" might be a clearer description?


Thank you!!!!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: