Professional Web Applications Themes

which performance is better - Microsoft SQL / MS SQL Server

hi, there from sql2000, user can also use user-defined function to return result like table. i am wondering, between Function and SP, which performance is better? appreciate your help...

  1. #1

    Default which performance is better

    hi, there
    from sql2000, user can also use user-defined function to return result like
    table. i am wondering, between Function and SP, which performance is better?
    appreciate your help





    Yibing Guest

  2. #2

    Default Re: which performance is better

    UDF's should not be thought of as a replacement for sp's. Usually if you
    can do what you want in a sp without difficulty then you should use a sp.
    Save the UDF's for operations that just can't be done with a sp. Usually
    these operations are when something has to be applied to each and every row
    of the result set and this can be slow. While not all UDF's are slow you
    will find the sp to be faster in most cases for the same effect.

    --

    Andrew J. Kelly
    SQL Server MVP


    "Yibing Wang" <com> wrote in message
    news:%phx.gbl... 
    like 
    better? 


    Andrew Guest

  3. #3

    Default Re: which performance is better

    Also, to add to what Andrew has replied:
    A UDF should be created for 1 reason and it's just good programming
    fundamentals.
    ....to be reused by stored procedure.
    Why create a UDF that will be used by 1 SP.
    Personnally, I use UDFs for mainly 3 reasons (but that's just me).
    1. I keep user preferences in a table (such as language). When information
    is requested, the SP calls the UDF that returns these preferences. A single
    value is returned.
    2. To handle comma-delimited lists. In this case, the UDF returns a table.
    3. Validation. Returns a single value which is a state (true or false).

    "Yibing Wang" <com> wrote in message
    news:%phx.gbl... 
    like 
    better? 


    raydan Guest

Similar Threads

  1. FMS X FCS (Performance)
    By tiago.braga in forum Macromedia Flash Flashcom
    Replies: 3
    Last Post: November 23rd, 09:35 PM
  2. Performance
    By Stephan in forum Coldfusion Database Access
    Replies: 16
    Last Post: July 28th, 05:37 PM
  3. Performance monitor causes performance problems
    By Jani in forum Windows Server
    Replies: 0
    Last Post: July 15th, 08:38 AM
  4. performance tools for yzing java performance
    By dfdashk@unix.com in forum Sun Solaris
    Replies: 6
    Last Post: August 28th, 03:40 PM
  5. DB2 performance
    By ChristineLim in forum IBM DB2
    Replies: 1
    Last Post: July 31st, 02:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139