• Different file groups aren't so bad. If they're on different files, you might end up with a lot of wasted space, though. When you rebuild an index for anything over 128 extents (about 8 Megabytes... a pretty small thing), SQL Server will build a new index first, then drop the old one. With a clustered index, that means basically doubling the size of the file.

    That's ok if you're still adding data to that particular file. I've actually written a 2 hour lecture on what to do if that's not the case and you need to squeeze the partition/file down as small as you can before you set it to READ_ONLY.

    There are some tricks you can do on normal tables like disabling an index and then rebuilding it (doesn't work on clustered indexes, though) or doing a CREATE WITH DROP EXISTING but none of those things will work on a partitioned table partition.

    Also be advised that a REBUILD will also be fully logged if the database is in the FULL RECOVERY model.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)