fixing query performance

Change-Id: I4910d4e46ab436ddf48a10c357ee68fe7edc4c2c