Improve performance when querying