Re: Do UDFs slow down Stored Proc execution?
From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 11/17/04
- Next message: j1c: "Cross-database trigger"
- Previous message: Gerry Viator: "Re: Query returns some rows twice"
- In reply to: John Kotuby: "Re: Do UDFs slow down Stored Proc execution?"
- Next in thread: John Kotuby: "Re: Do UDFs slow down Stored Proc execution?"
- Reply: John Kotuby: "Re: Do UDFs slow down Stored Proc execution?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 17 Nov 2004 17:11:32 -0500
"John Kotuby" <jkotuby@snet.net> wrote in message
news:udBljDPzEHA.4028@TK2MSFTNGP15.phx.gbl...
>
> I don't know if you actually want to see that proc. I don't think anyone
> has ever posted 1000 lines of code for comment. What I am beginning to
> suspect is that this large proc should be broken down into a hierarchy
> of smaller procs that SQL Server can digest more readily. How does one
> "tune" such a large procedure?
>
People have posted sprocs larger than that... and I've ignored their
posts ;)
Seriously, though, tuning procs that large can be a pain. Your best bet
is, as you suspect, breaking it down into smaller chunks. It sounds like
that stored procedure does many different types of tasks which should be
logically separate, so it sounds like a good candidate for factoring out
into smaller pieces. So start there. That will let you focus on it in
small parts rather than looking at the whole thing at once, which is going
to be overwhelming. Don't worry about duplicated code too much -- that's
how most of these monster stored procs begin life -- someone thinks they can
be clever. Clever is, generally, not as good as maintainable! Take it
piece by piece, learn to use Query Analyzer's Show Execution Plan option
(which is absolutely essential), and start by eliminating as many "scans" as
possible. You'll want to look at sites like www.sql-server-performance.com
. If the book you're referring to is the one by Ken England, good choice.
That's a good primer... If it's by someone else, I can't comment :)
-- Adam Machanic SQL Server MVP http://www.sqljunkies.com/weblog/amachanic --
- Next message: j1c: "Cross-database trigger"
- Previous message: Gerry Viator: "Re: Query returns some rows twice"
- In reply to: John Kotuby: "Re: Do UDFs slow down Stored Proc execution?"
- Next in thread: John Kotuby: "Re: Do UDFs slow down Stored Proc execution?"
- Reply: John Kotuby: "Re: Do UDFs slow down Stored Proc execution?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|