Optimized some analytics.jsp queries