Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

SP runs slow but code doesn't
I have an SP that I can run in query analyzer and it takes about 45secs.  Th
e
code copied from the SP runs in about 5 seconds in query analyzer.  There ar
e
a couple datetime parameters passed to the SP.  I have these as variables in
the code that is copied. I will note that the stats/IO of the SP are much
greater than the code ran by itself.  I think that's the issue.  The query
plans for each are about 150 lines and from what I can tell are identical.
But one causes a great deal more reads (for the SP) than the other (for the
code).  Can someone tell me why this is?  I rebuild indexes on weekends.  Ho
w
can I fix it so that the SP runs as fast as its code copied to another query
analyzer window?  I traced for recompiles as well...didn't see any.

Thanks,

Van

Report this thread to moderator Post Follow-up to this message
Old Post
Van
11-30-05 01:23 AM


Re: SP runs slow but code doesn't
Did you try it *with* recompile?
You are probably not recompiling and therefore using a bad cached plan.

"Van" <Van@discussions.microsoft.com> wrote in message
news:0B3AD70A-7428-44A4-BF9C- 2FECD4AB599A@microso
ft.com...
>I have an SP that I can run in query analyzer and it takes about 45secs.
>The
> code copied from the SP runs in about 5 seconds in query analyzer.  There
> are
> a couple datetime parameters passed to the SP.  I have these as variables
> in
> the code that is copied. I will note that the stats/IO of the SP are much
> greater than the code ran by itself.  I think that's the issue.  The query
> plans for each are about 150 lines and from what I can tell are identical.
> But one causes a great deal more reads (for the SP) than the other (for
> the
> code).  Can someone tell me why this is?  I rebuild indexes on weekends.
> How
> can I fix it so that the SP runs as fast as its code copied to another
> query
> analyzer window?  I traced for recompiles as well...didn't see any.
>
> Thanks,
>
> Van



Report this thread to moderator Post Follow-up to this message
Old Post
Bud Y. Zer
11-30-05 01:23 AM


Re: SP runs slow but code doesn't
Yes, I've also tried doing an sp_recomplile on the SP and running it a few
times.  No change.

"Bud Y. Zer" wrote:

> Did you try it *with* recompile?
> You are probably not recompiling and therefore using a bad cached plan.
>
> "Van" <Van@discussions.microsoft.com> wrote in message
> news:0B3AD70A-7428-44A4-BF9C- 2FECD4AB599A@microso
ft.com... 
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Van
11-30-05 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 11:21 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006