• Adi Cohn (9/14/2009)


    This is done on purpose. When you create a clustered index on a heap you might want to move the table to a different file group, but you might want to keep the table on the same file group that it was created on. The table and clustered index have to be on the same file group, but when you create the clustered index if you won’t specify it’s location, it will be created on the same file group as the table. If you will specify a specific file group, it will be created on that file group and the table will be moved to this file group. The only difference when you create a clustered index or a nonclustered index, is that the table might be moved, but this has nothing to do with the way that the server “decides” on which file group the index will be created. At both cases (creating clustered and nonclustered index) the way this “decision” is dictated to the server by the user’s input.

    Adi

    :pinch: I'm sorry but as written this is wrong.

    The reason why a clustered index ALWAYS goes to the same filegroup the table goes is because the leaf level of the index is actually sitting inside the base table.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.