Table Rebuild Avoids Excessive Lookups After Data Type Change
I’ve run into a situation at a number of sites where the following occurs
- An excessive number of logical page reads during query execution
- Changes have occurred from ntext, text, or image data types have been replaced by nvarchar(max), varchar(max), or varbinary(max) data types, as part of a clean-up of deprecated data types.
- Rebuilding the table greatly reduces the number of page reads and the customer is puzzled about why.
One of the causes for this situation is related to how the data in these columns is stored. The ntext, text, and image data types defaulted to having their data stored out of row. The row contained a pointer to where the data was located. By comparison, the nvarchar(max), varchar(max), and varbinary(max) data types default to storing data in-row where possible.
2014-11-17