WHERE ((ITEM_ID=? AND PLANT_ID=?) OR (ITEM_ID=? AND PLANT_ID=?) OR ... (ITEM_ID=? AND PLANT_ID=?))
and
SELECT *
FROM EntityClass AS T
WHERE EXISTS (
SELECT *
FROM (VALUES (?,?), (?,?), (?,?), (?,?)) AS V(ITEM_ID,PLANT_ID)
WHERE T.ITEM_ID = V.ITEM_ID
AND T.PLANT_ID = V.PLANT_ID
)
I'm wondering what makes the second faster, is the sql is more efficiency in DB or the parameter binding part in hibernate is faster .
could you try to run these two in sql server directly w/ values binded and see if there is any difference?
P.S. I have no idea if Sql Server supports that tuple syntax or not, if someone could verify it would be great.
This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira