Processing data: Ruby or SQL?

PostgreSQL