I have used below query to get space for tables. I have one doubt...
I have 4 tables say...Two main tables and 2 staging tables(_TMP). Though the count in main tables is more the staging tables, I dont understand why data size is different and unused is different? In fact, main tables having lot data space and unsed space. How the system will allocate table space? There is proper indexing and primary key relationship on main tables but not on _TMP tables.Please help me out.
Data getting into staging tables (_TMP) is thru SSIS and from this tables data moving to main tables thru SSIS. What is the mechanism of allocating space in ms sql?
tablename | row_count | reserved | data | index_size | unused |
ABC | 575738 | 62280 | 36176 | 22184 | 3920 |
ABC_TMP | 575736 | 10500920 | 9741888 | 112 | 758920 |
XYZ | 762933 | 215632 | 148080 | 66912 | 640 |
XYZ_TMP | 610128 | 13884472 | 13722816 | 112 | 161544 |