Hi guys,
the setup is as following: SQL Server 2008R2, recovery model FULL in order to better track what's going on in the transaction log.
CREATE TABLE dbo.justnumbers(id INT IDENTITY, number FLOAT NULL); CREATE UNIQUE CLUSTERED INDEX CI_number ON dbo.justnumbers(id); --Fill the table with 500K unique numbers (no nulls).
Now I want to check how much traffic in the transaction log will produce changing the column 'number' in not null.
CHECKPOINT; ALTER TABLE justnumbers ALTER COLUMN number FLOAT NOT NULL; --1 sec SELECT * FROM fn_dblog(NULL, NULL); --31 records in the transaction log, touching olny the metadata such as sys.sysrscols.clst
Nothing needs to be updated in the table, null bitmap is anyway always present for all columns (see "three null bitmap myths" by Paul Randal http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-630-three-null-bitmap-myths/).
Everything is fine.
Now I want to try the same with a page compressed table.
DROP TABLE dbo.justnumbers; CREATE TABLE dbo.justnumbers(id INT IDENTITY, number FLOAT NULL); CREATE UNIQUE CLUSTERED INDEX CI_number ON dbo.justnumbers(id); --Fill the table with 500K unique numbers (no nulls). ALTER TABLE dbo.justnumbers REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE);
CHECKPOINT; ALTER TABLE justnumbers ALTER COLUMN number FLOAT NOT NULL; --4 sec SELECT * FROM fn_dblog(NULL, NULL); --530K records in the transaction logWhat the heck is going on there? Thanks for help