Why is parameterized SQL generated by NHibernate just as fast as a stored procedure?

前端 未结 13 2564
独厮守ぢ
独厮守ぢ 2020-12-14 20:47

One of my co-workers claims that even though the execution path is cached, there is no way parameterized SQL generated from an ORM is as quick as a stored procedure. Any hel

13条回答
  •  没有蜡笔的小新
    2020-12-14 21:22

    It is just as fast if the query is the same each time. Sql Server 2005 caches query plans at the level of each statement in a batch, regardless of where the SQL comes from.

    The long-term difference might be that stored procedures are many, many times easier for a DBA to manage and tune, whereas hundreds of different queries that have to be gleaned from profiler traces are a nightmare.

提交回复
热议问题