跟我一起学Microsoft SQL Server 2012 Internals(3.4)

目录

正确使用SQL Server文件与文件组

MS SQL Server引入文件组(filegroups)是为了简单的管理与分配数据(data)文件。同时,合理正确的使用SQL Server文件组可提升数据库的性能,如将数据、非聚集索引分别存放在不同的文件组中并存放在不同的物理磁盘上(注意:聚集索引是数据的一部分)。

默认情况下,所有的数据与索引均放置在primary filegroup中,除非创建了一个新的filegroup,并进行使用。SQL Server有两种类型的文件组:
1. Primary
2. User-defined

下图所示是检查数据库默认的文件组
文件组

这里首先区分一个概念:primary文件组(primary filegroup)与primary文件(primary file),即要区分文件组与文件的不同。我们在“跟我一起学Microsoft SQL Server 2012 Internals(3.2)”中简单提到了primary data file,即.mdf文件。而这里的filegroup是基于文件(file)基础上的一个概念。更多的内容可查看MSDN文章“Files and Filegroups Architecture”。

那么我们应该在什么时候使用多个文件,什么时候使用多个文件组?简单来说,使用多个文件可以方便的管理数据恢复或移动数据。

下图所示对数据库使用默认primary文件组,但设置了多个文件:
文件1

而在备份时可选择某个文件进行单独备份:
文件2

而当用户想使用SQL Server的数据与索引分区功能时,才有使用文件组(filegroups)的必要,关于SQL Server的分区相关知识可查看MSDN中“Partitioned Tables and Indexes in SQL Server 2005”。

另需注意:

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Improve your ability to develop, manage, and troubleshoot SQL Server solutions by learning how different components work “under the hood,” and how they communicate with each other. The detailed knowledge helps in implementing and maintaining high-throughput databases critical to your business and its customers. You’ll learn how to identify the root cause of each problem and understand how different design and implementation decisions affect performance of your systems. New in this second edition is coverage of SQL Server 2016 Internals, including In-Memory OLTP, columnstore enhancements, Operational Analytics support, Query Store, JSON, temporal tables, stretch databases, security features, and other improvements in the new SQL Server version. The knowledge also can be applied to Microsoft Azure SQL Databases that share the same code with SQL Server 2016. Pro SQL Server Internals is a book for developers and database administrators, and it covers multiple SQL Server versions starting with SQL Server 2005 and going all the way up to the recently released SQL Server 2016. The book provides a solid road map for understanding the depth and power of the SQL Server database server and teaches how to get the most from the platform and keep your databases running at the level needed to support your business. The book: • Provides detailed knowledge of new SQL Server 2016 features and enhancements • Includes revamped coverage of columnstore indexes and In-Memory OLTP • Covers indexing and transaction strategies • Shows how various database objects and technologies are implemented internally, and when they should or should not be used • Demonstrates how SQL Server executes queries and works with data and transaction log What You Will Learn Design and develop database solutions with SQL Server. Troubleshoot design, concurrency, and performance issues. Choose the right database objects and technologies for the job. Reduce costs and improve availability and manageability. Des

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值