• deepkt (1/20/2012)


    1. Transaction logs are not recorded for the table variables. Hence, they are out of scope of the transaction mechanism

    Half true. They are out of transaction scope, but that does not mean that they are unlogged. They are logged like any other operations

    2. Any procedure with a temporary table cannot be pre-compiled, while an execution plan of procedures with table variables can be compiled in advance.

    Stored procedures are never pre-compiled. Execution plans are created on first execution only and remain until invalidated or removed from cache. In SQL 2000 temp tables did always cause recompiles, not the case in 2005 or above.

    You also neglected to mention the severe performance implication (in a bad way) from the lack of statistics on table variables. They should be avoided if the correct costing of execution plans is even a consideration.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass