Well that brought it to 31841mb now. I ended up just taking the number of LOB columns (max_length = -1) which was 43, multiplying that by the number of rows (1.7mm) and got 1431mb. so now only 8% off lol.
Sorry not sure I'm following. I completely agree that the DM gives me 34440, but datalength gives me 30410. And adding any of those types in the DM does not get me the 30410 (or close to it)
ok riddle me this, Batman... the query you provided me doesn't work. But when I removed the clustered index criteria it did. It looks like all my data is in Index_id = 1.
oh gotcha, I hadn't even considered the non-leaf nodes. Could that be where most of the 15% is coming from? I forget how to get the # of pages in the non-leaf nodes to check.
If we are only looking at the clustered index (using the joins/criteria), then the only index that would be included in used_pages woudl be the clustered index right? I'm ok with that
@PaulWhite thanks for condensing the comments into the original question and moving this to chat. Never had a question go on like this so I wasn't sure of the protocols and all.
@Frisbee LOL yeah, I like that answer :) If I cannot determine where the 15% is coming from I had always planned on doing the methodology presented in the other answer and just extrapolating my 85% out to the full page size summation. But I know if I don't do my do diligence to figure out where the missing percent is coming from, management won't even listen to me. So I really appreciate everyone's time on helping me figure out where I'm missing storage :)
I rebuilt the clustered index and the size did not change much (I am still 15% difference). which other reason above could be accounting for such a large difference. Someone had asked if I am using nullable or sparse columns (but that comment seems to have disappeared), yes I have nullable columns, not sure how to tell if any of the columns are sparse, though).
@AaronBertrand I completely agree. And we wont' be rebuilding it each month to do the billing. I just want to do it once here to see if that accounts for most of the 15%. If there is still a lot of that 15% left, I'd like to get your ideas on what else may be accounting for that 15%.
@AaronBertrand you misunderstand. I want to be able to show my management team where the 15% difference comes from. So my idea is to rebuild it and if that removes most of that 15% then I can show that to them and we go forward with just doing a percent allocation (as described in the other answer). However, if we are still off by a large percentage we have concern. So question again :) would rebuilding clean up most of that 15% (knowing there are a lot of small pointers, headers, etc, but on a very large table it should account for only a small percentage of difference).
Yes, I hadn't considered that one is the actual size of the data (DATALENGTH), while the other query is the size in pages. I see why they do not tie out exactly. But to be 15% off? What is making up most of that 15%? Fill Factor and rows marked for deletion are probably the largest component (if we even have any of those), right? And if I rebuilt the clustered index I would clean that up and supposedly that 15% would be smaller, right?