Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rasmasyean
Starting Member
22 Posts |
Posted - 2011-06-19 : 22:49:49
|
Can someone give some input on when to use SQL functions vs. programmatically handling your results?Does it stress the database a lot if you do SQL functions on a large result set? Or is it better to let the SQL do the stressing vs. letting the program do loops, etc.I mean, even if you want to "reduce the size" of the result set, like a substring... around what size difference is it efficient to use SQL functions rather than just returning the whole string and chopping it up with your program? |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2011-06-20 : 13:47:59
|
generally speaking string manipulations are usually better handled outside the database. However, a built-in sql function like substring is pretty efficient. If it significantly reduces the amount of data you are sending to the application than that can be a big factor. The best thing you can do is set up some tests see for yourself. Then let us know what you find. In most cases when I see performance problems they are caused by poorly designed models and poorly designed queries. The only time I've seen substring be a performance hit is when it is included as part of the JOIN criteria preventing an index from being used in the execution plan.Be One with the OptimizerTG |
|
|
|
|
|