Solved

SQL Server - data files - How is write operation performed  on data files

Posted on 2009-07-01
6
381 Views
Last Modified: 2012-05-07
Hi,

   I would need some clarifications on how the write operations are performed on SQL Server data files.
   
   Say that we have only one file group (PRIMARY) with 10 data files inside. What I would need to know (I would needk if possiblek a valid Microsoft link next to the explanation) is, in case SQL Server needs to write 100 MB of data inside these data files how is the write operation done? (also considering that the 10 data files are not equal in size and that the free space inside each of the data files is also not equal in size).


Thanks in advance
0
Comment
Question by:rares_dumitrescu
  • 3
  • 3
6 Comments
 
LVL 2

Expert Comment

by:Sguzek
ID: 24753950
Hi,

The topic is quite big. Better start from reading "Physical Database Storage Design" http://technet.microsoft.com/en-gb/library/cc966414.aspx, you will find further references there.

Regardsm
Slawek
0
 

Author Comment

by:rares_dumitrescu
ID: 24754159
Hi,

    I read this one but it does not say how exactly data is written when you have more data files in the same file group.

    I have a very good understanding about the overall SQL Server storage picture but I need a more to the point explanation.

     As I know SQL Server should stripe the extents across the data files and theoretically what happens is that write operations are load balanced between the data files. Now I need to know the formula or the thinking behind this load balancing operation- how much weight a data file size and the free space inside inside has when SQL Server decides how much to write to one data file and how much to write to the other.

Thanks
0
 
LVL 2

Expert Comment

by:Sguzek
ID: 24755126
Hi,

No, extents are not stripped across data files. I mean single extent is never stripped across data files.

Load balancing works only when new extents are allocated. If SQL storage engine has to allocate one new extent  then it is allocated from the file with most free storage space. When it needs to allocate more than one extent then the first new extent goes to the data file with most free space, and second can go to the same file if after allocating first extent still the most space is in the same file.

As long as the free space will not be balanced between files all new extents will be allocated from the file with the biggest free storage space - so it is crucial to create database with data files equal in size.

FILEGROUP has nothing to do with physical data allocation as far as I now - it is used only for logical management, like backups etc.

Regards,
Slawek





0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:rares_dumitrescu
ID: 24799005
Hi Slawek,

     This is exactly what I also suspect judging by the SQL2k5 I/O DMVs, do you also have some web-links for this info?

Thanks
0
 
LVL 2

Accepted Solution

by:
Sguzek earned 500 total points
ID: 24813548
Hi,

I'm not aware of any web source where this was stated explicitely, I'm afraid.

Regards,
Slawek
0
 

Author Comment

by:rares_dumitrescu
ID: 24817534
thanks
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Solid State Drive Performance Tips: Solid state storage technology is now a standard.  After testing and using several different brands and revisions of SSD's over the years I have put together a collection of tips,tools and suggestions that I ha…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video teaches viewers how to encrypt an external drive that requires a password to read and edit the drive. All tasks are done in Disk Utility. Plug in the external drive you wish to encrypt: Make sure all previous data on the drive has been …
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now