SQLTeam.com | Weblogs | Forums

Table partition switching

hi all,

as we know, table partition switching allow us to rebuild index for the staging table before switching the partition in to fact table. however, after switching into the fact table, should we update the statistic of the fact table?

It depends. See here: SQL Server 2012 partitioned table statistics update behavior change when rebuilding index

1 Like

hi gbritton, thanks! thats help alot but can you help me to understand more?
statistic in partition table is partitioned, therefore if we switch to a staging table and rebuild index + update statistic and finally switch back in, the fact table going to have an updated statistic?

but how it works? in the index, the partition column i placed at the last of the column ordering, which means that the switch out rebuild index does not work?

As the article says, statistics will be rebuilt but not using a fullscan, so they will be approximations.