Check if the statistics are off for table variables

  • Hi,

    How do I check if statistics are off for table variables?

    Thanks,

  • SQL Server doesn’t have statistics for table variables like histograms and density vectors.

    It always estimates the number of rows as 1, though I'm not sure if this is true for SQL Server 2016.

  • Jonathan AC Roberts wrote:

    SQL Server doesn’t have statistics for table variables like histograms and density vectors.

    It always estimates the number of rows as 1, though I'm not sure if this is true for SQL Server 2016.

    Yes, still estimates at 1 on 2016. It's supposed to be improved on SQL Server 2019 with "table variable deferred compilation" feature. The estimates are improved but I've read some mixed things on it, particularly with parameter sniffing.

    Sue

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply