[GEOS-5317] Fetching data from sql views uses more queries than strictly necessary