SQL Server table with 4,000,000 rows is 40GB

You have 4,000,000 rows and one of the columns averages 8,000 characters (16,000 bytes, I assume).

SELECT CONVERT(bigint,4000000) * /* b */ 16000 / /*kb*/ 1024 / /*mb*/ 1024;
------
61,035

If your stats are accurate, I'd expect this table to be 61 GB. (I wonder if you mean 8,000 bytes, not 8,000 characters, in which case I'd expect > 30 GB.)

Other factors include:

  • data in other columns I didn't account for in the above calculation
  • additional indexes
  • fill factor > 0 and < 100
  • fragmentation and space still occupied by deleted rows or page splits