Reduce SQL queries for menu generation