Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2009-07-01
6
386 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
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…
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

839 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