SQL Server partitioning (2008)

I am upgrading a database from using old style partitioning to new style (2008) partitioning. It has 200,000,000 + rows and is currently partitioned on Date using horizontal 2000 style partitioning i.e. many tables and a union view.

I wanted to check on the progress of the data import and also make sure the data is going in to the correct file group. Here’s some SQL on how to do this.

select
object_name(SI.object_id) as objectName
,F.name
,SP.rows
,DS.*
from sys.destination_data_spaces    DS
join sys.filegroups                                       F  on    F.data_space_id = DS.data_space_id
join sys.indexes                                          SI on    SI.data_space_id = DS.partition_scheme_id
join sys.partitions                                     SP on    SP.object_id = SI.object_id
and SI.index_id = SP.index_id
and SP.partition_number = DS.destination_id

Advertisements

About davidbridge

I am a contractor for David Bridge Technology Limited specialising in database design and Web development using Microsoft technologies such as c#, MVC .net and SQL Server (full stack)
This entry was posted in SQL Stuff, Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s