• Even though both operators have the word SCAN in them, there is no real comparison between a Constant Scan and an Index/Cluster/Table Scan.

    Usually, but not always, an Index/Cluster/Table Scan is indicative of poor performance, a badly structured index or a badly structured query. A constant scan is a construct within SQL Server that builds a location for storing data, usually a logical location, not a physical one like with a hash or a spool.

    In your case, the multi-statement function is what the constant scan represents, and it is indicative of poor performance. UDF's are just dangerous, though useful, constructs. Instead of comparing operator costs between execution plans (a very poor way to estimate query costs), I'd suggest looking at execution time, I/O and CPU time. Just use the execution plans to understand what's happening within the stored procedure, not to compare performance between queries.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning