I have a stored procedure in my database. As per my knowledge it's pre-compiled subroutine.
Question 1: If I execute following queries from Hibernate, will database create a separate execution plan for each query? In which case SQL Server update/change stored procedure Execution Plan?
EXECUTE myProcedure 'vicky.thakor', 'Routine Check Up'
and
EXECUTE myProcedure 'chirag.thakor', 'Routine Check Up'
Question 2: This is bit of programming question but you guys may explain me bit of it. In Java there is something called PreparedStatement
. PreparedStatement
is similar to pre-compiled query.
PreparedStatement
generates query like following and put value in place of ?
.
SELECT * FROM user_master WHERE user_name = ?
But database will receive the final query like
SELECT * FROM user_master WHERE user_name = 'vicky.thakor'
then how database help to get best performance when using PreparedStatement
.