Alex Rivera | Logout

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

Asked 2008-09-08T18:25:01.197
16

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 help with this stubborn developer?

Edit
Report

2 Answers

1

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.

answered 2008-09-08T18:28:08.957
0

Measure it.

Really, any discussion on this topic is probably futile until you've measured it.

answered 2008-09-08T18:29:11.280

Your Answer