It is very common to use temporary data structures in the database.
In SQL Server, we can choose between temporary tables (#MyTable) and table
variables (@MyTable). There are many differences between these two structures,
some are obvious and well known, and some might surprise you.

The main difference in terms of performance is statistics, which
exist for a temporary table, but do not exist for a table variable. For that
reason, there can be a huge difference in performance of a stored procedure
that uses one data structure or the other.

In this session, we will demonstrate the differences and analyze
performance for various use cases. We will cover all kinds of ways to work with
these data structures, such as OPTION (RECOMPILE) and trace flag 2453.

By the end of this session you will know exactly when and how to use
each one in order to achieve the desired functionality with the best performance.
(no tags)
The video is not available to view online.