|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Friday, November 09, 2012 12:51 AM
Points: 429,
Visits: 187
|
|
Very well said Hugo.
That's pretty much what I was trying to say although I wasn't thinking of Space (since today, disk space is pretty cheap)... your explanation is excellent.
Thank you for clarifying. JGhali
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Friday, December 07, 2012 9:27 AM
Points: 361,
Visits: 507
|
|
I guess now would be a good time to point to a great post by PaulWhiteNz about UDFs and SCHEMABINDING which I can not find right now. My read performance is quite good while write sucks as I am on my iPhone;) Paul could you quote yourself please?
Here is the link to a discussion on SSC: http://www.sqlservercentral.com/Forums/Topic737008-360-1.aspx#bm738974
Hrvoje Piasevoli
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 10:48 AM
Points: 10,990,
Visits: 10,578
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 10:27 AM
Points: 1,384,
Visits: 4,881
|
|
I hate "me too" replies, but I also failed on the "Will definitely use more resources" option, because it is just not true. Consider the alternative of a standard column populated by a trigger. A trigger will update the column on every insert and every relevant update; whereas the computed column will only be evaluated when it is selected. If you never include the column in a select statement then how can it use more resources? And yes I know that you wouldn't create a computed column that you don't intend to use, but a seldom-accessed computed column is still going to use fewer resources than a trigger.
I didn't choose "The engine tweaks to be performant." as I have no idea what it means!
Final whinge, it's a shame that these multiple-check-box question give the marks on an all-or-nothing basis; choosing 4 out of 5 correct options scores the same as choosing no correct options but every incorrect one
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Monday, May 06, 2013 5:31 AM
Points: 2,226,
Visits: 438
|
|
Nice question, and as everyone else pointed out, the computed columns doesn't need to user more resources. Hugo gave an excellent example on how it could use less resources.
/Håkan Winther MCITP:Database Developer 2008
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Friday, May 03, 2013 6:06 AM
Points: 699,
Visits: 272
|
|
In the example,
create table a ( col1 int, col2 int, col3 as col1, )
col3 is technically a computed column, but uses only an extremely low amount of cpu time, especially since it does only a simple in-memory copy operation, but since it's not read from a disk buffer, is probably actually more efficient than a normal column. The statement 'definitely uses more resources' may be a stretch. I would agree that an expression utilizing a SELECT or UDF would use more resources and could potentially cause performance issues.
|
|
|
|