Optimized database queries.