Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Excessive sp_executesql usage Expand / Collapse
Author
Message
Posted Tuesday, April 23, 2013 8:34 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, June 28, 2014 2:49 PM
Points: 116, Visits: 346
My devs seem to use sp_execute even for the execution of SPs. Is there any downside to this dynamic model?

Greetz
SQL Pizza



sometimes you dont see the pizza for the toppings...
seek and ya shall find...
Post #1445477
Posted Wednesday, April 24, 2013 4:42 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 12:05 PM
Points: 15,500, Visits: 27,885
As long as they are calling procedures or creating parameterized queries, not really. It might tend to bloat the cache a little depending on how the calls are generated since additional statements around the EXEC sp_executesql could be stored there. That would be my one concern once I was sure they weren't just generating ad hoc T-SQL.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1445849
Posted Friday, April 26, 2013 9:19 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 4:52 PM
Points: 7,079, Visits: 12,569
As a side note, using sp_executesql is pretty much how every query from SMO (objects used by SSMS) is issued against the instance. The SQL Agent team coded their queries this way as well and they did a lot of things wrong initially and it did result in plan cache bloat. If you run a Trace on your instance and then navigate around the Object Explorer in SSMS and run a few SQL Agent jobs you'll see what I mean.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1447059
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse