Hacker News new | ask | show | jobs
by forcemajeure 2479 days ago
AFAIK it's also proportional to the number of rows with data in the indexed columns. Inserting a row with a NULL in the indexed column does not cause an update to the index (at least experimentally it doesn't seem to contribute to index size on SQL Server).

I imagine this is/was a simple optimization for DBMS to implement, but I would love to be corrected otherwise...

1 comments

If you change a value to null it’s still a row allocated in the index. The index size won’t shrink unless you rebuild it. Removing and deleting data will just end up with fragmentation.