Is there a row count that makes table variable’s inefficient or what? I understand the differences between the two and I’ve seen some different figures on when that point is reached, but I’m curious if anyone knows.
Is there a row count that makes table variable’s inefficient or what? I understand
Share
When you need other indices on the table other than those that can be created on a temp table variable, or, for larger datasets (which are not likely to be persisted in available memory), when the table width (number of bytes per row) exceeds some threshold (This is because the number or rows of data per I/O page shrinks and the performance decreases… or if the changes you plan on making to the dataset need to be part of a multi-statement transaction which may need to be rolled back. (changes to Table variables are not written to the transaction log, changes to temp tables are…)
this code demonstrates that table variables are not stored in Transaction log: