optimize resources query

added multi column index and tuned the query