Rebalancing blob and lob data in multiple files on primary file group

  • Hi all,

    A little background on what I am trying to achieve first. We are moving to Azure virtual machines and we will have 8 disks on the SQL Server box. I am adding more files to the primary file group and each file will go on its own drive. I am then rebalancing data across these files by rebuilding all of the indexes on the tables which is working fine. No problems so far all is good.

    I now have an additional problem. If there is a lob or blob column on the table, rebuilding the clustered index and all the non clustered indexes doesn't rebalance the blob or lob data across the disks such as it does with in row data.

    I cannot find any articles on rebalancing lob or blob data because all the articles say to move to a new file group. I do not want a new file group, I just want to use the primary file group where the data already resides, and just redistribute it evenly in the same way that I can in row data which is working fine.

    One solution I thought about was to BCP data out of the table, truncate the table and then BCP back into the table which I imagine would have the desired effect of distributing the data evenly over the files, however this seems a little long winded in my mind.

    Just wondering if anybody else had a more elegant solution than this?

  • Why not to select * into table_having_blob_1 from table_having_blob, then drop table_having_blob and rename table_having_blob_1 to table_having_blob.

  • I could but selecting all that data out twice is very slow. The table is 12GB so it would probably take at least a few hours this way. That is why I was thinking about using the same concept but with BCP as it is built to deal with large datasets. I did a test run to copy data out and even with BCP it took 1h 40m to copy all the data out to a file. That doesn't include truncating the table and then reinserting the data.

    The issue is we don't really have many windows to run things like this and I'm looking for the fastest way possible really. If there are any options I can add to an index rebuild command or something along those lines?

    Do you have any other ideas?

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply