Optimized some data access queries.

The survey response query and stream data query were optimized.