April 22, 2015 at 11:45 pm
Comments posted to this topic are about the item How long do they last?
April 22, 2015 at 11:50 pm
Very interesting & unique question, thanx!
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
April 23, 2015 at 12:15 am
Thanks for this one! Got it wrong and learned something quite useful.
April 23, 2015 at 12:52 am
Great Question Carlo, thanks!
Igor Micev,My blog: www.igormicev.com
April 23, 2015 at 1:36 am
Great question, something new and quite useful.
____________________________________________________________
APApril 23, 2015 at 2:34 am
This was removed by the editor as SPAM
April 23, 2015 at 2:38 am
Excellent illustration of how query folding and constant evaluation is used by the query optimizer. Many thanks Carlo.
April 23, 2015 at 2:47 am
One of the most interesting questions I've seen. Thanks for that!
April 23, 2015 at 2:53 am
Great question & thanks for the links.
Found this interesting in the Non-Foldable list on the MSDN page:
Expressions whose results depend on a local variable or parameter
Which casts a whole new light on parameter sniffing & why converting to local variables can help get around bad sniffs.
April 23, 2015 at 3:25 am
Graham_Day (4/23/2015)
Excellent illustration of how query folding and constant evaluation is used by the query optimizer. Many thanks Carlo.
+1
April 23, 2015 at 6:07 am
Agreed. That was a great question. It perfectly illustrates how subtle differences in calling a function can have a huge impact on performance. Of course, it all goes back to understanding how things work and testing. Thanks for a really good question.
April 23, 2015 at 7:16 am
Excellent question. I got it right by deduction more than understanding. I figured the scalar would run for each row but I would have thought the itvf would too...but then figured it wouldn't even be a question if the time was the same. 🙂 Good way to start the day by learning something new.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 23, 2015 at 10:27 am
Sean Lange (4/23/2015)
Excellent question. I got it right by deduction more than understanding. I figured the scalar would run for each row but I would have thought the itvf would too...but then figured it wouldn't even be a question if the time was the same. 🙂 Good way to start the day by learning something new.
I started from the opposite end, the itvf (because that's a part of the SQL world that I understand) and it was obvious it would only run once. Then I made the silly guess that the scalar valued function would be treated the same way, so I got it wrong.
Tom
April 24, 2015 at 12:38 am
Great question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 27, 2015 at 7:00 am
Great question, thanks.
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply