• yogesh.balasubramanian (10/3/2011)


    I see a relavent article and it seems like table variable is much faster than temp table.

    Ref: http://sqlserverperformance.idera.com/uncategorized/performance-comparison-temp-tables-table-variables-sql-server/

    :unsure: Confused on which one is better?

    One item that the question hoped to illustrate is that like most things in SQL SERVER (T-SQL) "IT DEPENDS"

    For example - additional testing using SQL Server 2008

    Processing Time (in milliseconds)

    #Rows Table Variable Temp Table

    20,000 68,773 386

    2,000 633 70

    200 33 23

    20 16 20

    Add in further modifications to the Temp Table, such as an index, and the results change again. So in the real world, do not depend upon

    assumptions, or what others say is the best method. Test YOUR solution and test it again and again to insure it is the better solution before placing it in a production DB

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]