I don't think this is a good way to do this. The method you're using only supports this optimisation when querying a table directly. If there were subqueries, joins, etc then it wouldn't work as there are no unique indexes. You should probably have a look at [1] to see further details of an alternative method without the said limitations.