• John Mitchell-245523 (6/25/2013)


    Lowell (6/25/2013)


    I think one of the join criterias are using scalar functions though...i think that is the performance killer here:

    isn't this three different scalar functions being used to create the joins??

    [dbo].[tipo_id_std]()

    [dbo].[get_release_id]()

    [dbo].[skus_min_drel]()

    Mmm, you're right, Lowell. I didn't even notice that amongst the lack of aliases and the square brackets. I agree: this is what's hurting performance, not the index not being used.

    Marco, scalar functions are bad for performance because they have to be executed for each row, and because they make the clause non-SARGable, which means that any index on the columns in question will (probably) not be able to be used.

    John

    Thanks John,

    I use the function because I have a large amount of .sql files and I prefer to store specific logic in only one point. They help me to have a simpler maintenance.

    For the moment I never have had performances issue with my function.

    Bye Marco