I have multiple indexed views that I want to move from the primary filegroup into another filegroup, with minimal impact on performance. How can I accomplish this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This should generate the script to do what you want, including both the clustered and any non-clustered indexes. I’ve added the
ONLINE = ONoption to minimize impact to existing workload but, in theory anyway, your indexed views shouldn’t be huge and so shouldn’t have any drastic impact. Of course this option is only available in Enterprise Edition, and the script handles that. If you can’t do it online you’ll certainly want to test the impact with a simulated workload (and you’ll want to test this operation in a test environment first in any case). And you are best off scheduling this work for a relative downtime or, ideally, a maintenance window.This should yield a script like:
When you’re happy with the
SELECToutput (works best inresults to textmode, but still is limited to 8K there and only if you change the setting intools / options), uncomment theEXEC. But again, in a test environment first!