optimizer avoids scanning index on query matching ID
this an updated version of the previous patch
this one doesn't give error when ID doesn't exist
partial fix for jira: MB-9187