如何在文件组的不同文件上创建索引
我正在使用 sqlserver 2008 R2
有什么方法可以指定在文件组的辅助文件上创建表索引?
示例:
“Primay”文件组有 2 个文件:Catalog.mdf 和 Indexes.ndf
我如何指定在“Primary”文件组的第二个文件“Indexes.ndf”上创建新索引?
i'm using sqlserver 2008 R2
is there any way to specify that a table index is created on a sencondary file from a filegroup?
example:
"Primay" Filegroup has 2 files: Catalog.mdf and Indexes.ndf
how can i specify that my new index is created on the sencond file "Indexes.ndf" of "Primary" filegroup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
索引是在文件组级别创建的。您无法如此精细地指定文件组中的文件。听起来你真的应该将indexes.ndf本身设置为一个单独的文件组。
Indexes are created at the filegroup level. You can't get so granular as to specify a file within a filegroup. Sounds like you really should have made indexes.ndf a separate filegroup itself.
简短的回答:否。
较长的回答:数据文件组中的文件用于 SQL Server“负载平衡”;换句话说,数据均匀地分布在多个文件中。如果要为文件指定特定位置,则需要在该新驱动器上创建辅助文件组并使用它。
问题:你为什么要这样做? IMO,将索引与数据分开并不会给你带来太多好处,而且可能会让你失去使用文件组(如文件组备份)的好处。这是关于该主题的好读物: http://weblogs.sqlteam.com/dang/archive/2008/08/01/Are-you-a-DBA-Monkey.aspx
Short answer: No.
Longer answer: files in a data filegroup for SQL Server "load balance"; in other words, data is spread across the multiple files equally. If you want to designate a specific location for a file, you'll need to create a secondary filegroup on that new drive, and use it instead.
Question: Why do you want to do this? IMO, seperating indexes from data doesn't buy you much, and could cost you the benefits of using filegroups (like filegroup backup). Here's a good read on the subject: http://weblogs.sqlteam.com/dang/archive/2008/08/01/Are-you-a-DBA-Monkey.aspx