We have a number of stored procedures where we pass in a user defined table type parameter. As per the MS doc below, my understanding is that SQL Server doesn't retain statistics on these (and therefore should only estimate a single row?).
Recently, we've seen issues with plan generation where the estimated number of rows in the table is a high as 2000 (normally only 1 or 2 rows are in passed in). This is caching a plan which is highly inefficient (wrong join order with a largish table ~160M rows) and causing some issues.
Am I wrong here about what the estimates should be? I could force the join type/order but I'd rather avoid this if at all possible.
Would really appreciate any thoughts/feedback people might have.
Thanks Dave