Jasinski Technical Wiki


Home Page
All Pages

Quick Search
Advanced Search »

Contributor Links

Create a new Page
File Management
Your Profile

Other Wiki Sections



Page History: Database Command Timeouts: Performance Differences between .NET and Management Studio

Compare Page Revisions

« Older Revision - Back to Page History - Newer Revision »

Page Revision: Wed, Jan 04, 2012, 3:22 PM


Why are there performance differences when a SQL statement is called from .NET app vs when the same call is made in Management Studio?


The root of the problem is a stale execution plan for the stored procedure being called. The first time the stored procedure is called after it’s compiled, SQL Server builds an execution plan for it based on the parameter values submitted. The solution was to recompile the stored procedure, then execute it within Management Studio with the parameters that causes the timeout when called from .NET. This causes SQL Server to build a new execution plan based on parameter values that returned data.

ScrewTurn Wiki version Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2020, Patrick Jasinski.