Multiple filegroups: yay or nay?

本文讨论了在SQL Server中使用多个日志文件和数据文件组的利弊。作者认为,在大多数情况下,增加额外的日志文件并不推荐,除非有特殊情况。而对于分离数据和索引到不同的文件组上,这会增加维护的复杂性,并且随着SQL Server 2005企业版引入在线索引重建功能,这种做法的优势已不再明显。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Multiple filegroups: yay or nay?

comes from: http://sqlserverpedia.com/blog/category/database-design/ 

 

Monday, September 29th, 2008

Stephanie wrote in with two questions:

  1. Is there a gain in getting 2 LDF (log) files for one database?  My opinion is no, because log file access is sequential, so no performance gain can be obtained and this will complicate maintenance.
  2. Is there a gain in separating the data & indexes onto 2 specific filegroups?  My opinion is no, because the way SQL Server handles indexes (as opposed to Oracle) does not help if you split them from the data.

First things first, multiple log files - I agree that you don’t want to do two LDF files for a single database unless there’s special circumstances.  At one shop, we had a pre-grown full-size log file for each database (with autogrow turned off), but we kept an “emergency” log file for each database on an empty drive.  The “emergency” log files were 1mb, and set to autogrow.  If a database completely ran out of log space in its normal pre-grown log files, then it would start using that “emergency” log file and growing it.  That was better than stopping the database completely, and gave us enough time to kill transactions and roll things back.

That certainly wasn’t a best practice, and it didn’t buy us any performance, but we had to do it based on the unpredictable nature of those applications and the way they would sometimes load huge amounts of data in a single transaction.  In that case, multiple LDF files served a purpose.  (When our Microsoft contact found out what we were doing, they hit the roof and told us to just go buy enough disk to be done with it, and the business guys finally decided to shell out the dough.)

Adding a second file adds complexity, like you said, and the same holds true whether it’s a log file or a data file, which segues into your second question.  Adding a second data file for indexes adds more design overhead - suddenly the DBA has to pay attention with where they’re placing objects.

In the days of my youth (ahh, for the sweet days of 2004), I liked this idea for my 1tb data warehouse because I could rebuild indexes faster with less impact on the end users.  Now that I’m old (okay, maybe just older) and SQL Server 2005 Enterprise Edition lets us rebuild most indexes online, I don’t bother with that anymore.

Plus, when I started managing storage area networks, I had a different reason.  Storage is getting faster and faster every year, but DBAs aren’t getting any more hours in their day.  Keeping data and indexes on different filegroups requires careful attention during development.  All it takes is one knucklehead adding an index without paying attention, and bam, you’ve got indexes on the data filegroup.  That means you have to introduce a new task into your daily/weekly/monthly routine: running a query to identify which objects are on which filegroups.

What a pain.

I’ve struggled with finding and hiring good DBAs, and if I have a choice between making my database 5% faster or making my DBAs 5% faster, I choose that latter option.  I can get 5% more storage performance by adding a few more drive spindles, but it’s harder - and more expensive - to get 5% more good DBA time.

On the other hand, if I was in a shop where my DBAs had plenty of time (or worked for peanuts, whate, then I would take a sandbox system, set it up the same way as production, and do performance benchmarking to see how much of a difference a separate index filegroup made on my exact hardware, storage and application.

You’re asking me, though, so I bet you don’t have the time to do that research either.  In that case, keep it simple!

标题基于SpringBoot的蛋糕烘焙分享平台研究AI更换标题第1章引言介绍蛋糕烘焙分享平台的研究背景、意义、现状以及论文的方法和创新点。1.1研究背景与意义分析蛋糕烘焙行业的现状,阐述分享平台的重要性和意义。1.2国内外研究现状综述国内外在蛋糕烘焙分享平台方面的研究进展。1.3论文方法及创新点概述论文的研究方法,突出创新点。第2章相关理论介绍SpringBoot框架和分享平台开发的相关理论。2.1SpringBoot框架概述简述SpringBoot框架的特点、优势和应用场景。2.2分享平台技术基础阐述分享平台开发所需的技术基础,如前后端分离、数据库设计等。2.3用户行为分析理论介绍用户行为分析的基本理论和方法,为平台功能设计提供指导。第3章平台需求分析对蛋糕烘焙分享平台进行需求分析,明确平台功能和性能要求。3.1目标用户群体分析分析平台的目标用户群体,了解其需求和特点。3.2功能需求分析详细分析平台应具备的功能,如用户注册、烘焙教程发布、互动交流等。3.3性能需求分析对平台的性能要求进行分析,确保平台的稳定性和可扩展性。第4章平台设计根据需求分析结果,设计蛋糕烘焙分享平台的整体架构和详细功能。4.1平台架构设计设计平台的整体架构,包括前后端分离、数据库设计等。4.2功能模块设计详细设计平台的功能模块,如用户管理、内容管理、互动交流模块等。4.3数据库设计根据平台需求,设计合理的数据库表结构和数据字典。第5章平台实现与测试介绍平台的实现过程,包括环境搭建、编码实现和测试等环节。5.1环境搭建与配置搭建开发环境,配置必要的软件和工具。5.2编码实现按照设计要求,编写平台的前后端代码。5.3平台测试与优化对平台进行测试,发现并解决问题,优化平台性能。第6章结论与展望总结论文的研究成果,展望未来的研究方向和应用前景。6.1研究结论概括论文的主要研究内容和取得的成果。6.2未来研究
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值