PostgreSQL-based solution to orange juice optimization problem