Improve query efficiency.

Get data query was very slow when there was a lot of data.
Merge pull request #32 from senseobservationsystems/fix-query_efficiency

Improve query efficiency.