首页 > 数据库

Multiple filegroups: yay or nay?

时间:2009-05-20 11:51:21  作者:武树伟  我要投稿
Linux初探欢迎您的投稿,投放方法请点击这里查看,我们会定期赠送精美小礼品给优秀的投稿作者。海纳百川 取则行远!LinuxGoo欢迎您的到来。
Multiple filegroups: yay or nay?comes from: http://sqlserverpedia.com/blog/category/database-design/Monday, September 29th, 2008Stephanie wrote in wit......

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.

如果您需转载 Multiple filegroups: yay or nay?,请注明来自LinuxGoo.com,其版权归原作者所有。请广大网友留言时遵纪守法,使用文明用语。如果您在应用中有什么问题,请在下面留言,我们会尽快解答。
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目热门