Hi to all ..
I've written two different queries as follows
My function is follows
FROM VEHICLE_TYPE VT WHERE VT.VEHICLE_TYPE_SNO = @VEHICLE_TYPE_SNO) END
HERE I'VE TO KNOW PERFORMANCE WISE EITHER INNER JOIN IS BEST OR PREDEFINED FUNCTION IS BEST
PLEASE HELP METHANKS TO ALL..........
If we compare between scalar value function and table function for requirement then table value function is good for performance point of view but for your requirement I go with join because any how through table value function also we are making join with main table then why not we directly join with main table. So for your requirement Inner join will be faster.
answered Nov 06, 2011 at 09:25 PM
To add to @kev riley's answer, you could rewrite your function to be a table value function, calling this using CROSS APPLY. This would perform just as fast as the inner join. You would change the code to return a table, keeping the select the same as you have now, so it is an easy modification to make.
answered Nov 06, 2011 at 03:50 AM
The function will be called for every row in VEHICLE_MASTER, whereas the join will be one operation that returns a set of data.Be aware that the execution plan may show that the function query is 'better', but this will be based on an assumption that the function is called once, returning one row.
answered Nov 06, 2011 at 02:03 AM
Kev Riley ♦♦