In my query i have cast and convert functions,which made my query run for long time.
When i removed those functions and replaced them with day/month/year functions and concatenated them for getting a format of date
which took less time.
Is this because convert() or cast() takes more execution time ?
Thank you
in advance
Vikrant MorePosted Feb 15, 2015, 7:17 AM
using scalar functions in where condition can cause to run function with every row to check for value we are passing lets say if there are 100 rows then the function will run with every 100 rows.
refer below links for more understanding of it,
http://www.mssqltips.com/sqlservertip/1236/avoid-sql-server-functions-in-the-where-clause-for-performance/
http://blogs.msdn.com/b/sqlserverfaq/archive/2009/10/06/performance-benefits-of-using-expression-over-user-defined-functions.aspx
Manish Kumar ChoudharyPosted Jan 23, 2015, 10:28 AM
VulpesPosted Jan 23, 2015, 10:23 AM
Of course, you get similar discrepancies when using 'library functions' from any programming language (not just domain-specific ones such as SQL). Sometimes it's much more performant to do things in a certain way.
Mukesh Kumar TiwariPosted Jan 23, 2015, 9:52 AM