Optimize number of SQL queries in Order details view