Fill Factor and Too Much Space Used

Okay, I am on sql server 2012 sp2.  I am doing a simple update on some large tables where there is an int column that allows nulls and I am changing the null values to be equal to the values in another integer column in the same table.  (Please
don't ask why I am doing dup data as that is a long story!)  
So it's a very simple update and these tables are about 65 million rows I believe and so you can calculate how much space it should increase by.  Basically, it should increase by 8 bytes * 65 million = ~500Mbytes, right?
However, when I run these updates the space increases by about 3 G per table.  What would cause this behavior?
Also, the fill factor on the server is 90% and this column is not in the PK or any of the 7 nonclustered indexes.  The table is used in horizonal partitioning but it is not part of the constraint.
Any help is much appreciated...

Hi CLM,
some information to the INT data type before going into detail of the "update process":
an INT datatype is 4 bytes not 8!
an INT datatype is a fixed length data type
Unfortunatley we don't know anything about the table structure (colums, indexes) but based on your observation I presume a table with multiple indexes. Furthermore I presume a nonclustered non unique index on the column you are updating.
To understand why an update of an INT attribute doesn't affect the space of the table itself you need to know a few things about the record structure. The first 4 bytes of a record header describe the structure and the type of the record! Please take the
following table structure (it is a HEAP) as an example for my ongoing descriptions:
CREATE TABLE dbo.demo
Id INT NOT NULL IDENTITY (1, 1),
c1 INT NULL,
c2 CHAR(100) NOT NULL DEFAULT ('just a filler')
The table is a HEAP with no indexes and the column [c1] is NULLable. After 10,000 records have been added to the table...
SET NOCOUNT ON;
GO
INSERT INTO dbo.demo WITH (TABLOCK) DEFAULT VALUES
GO 10000
... the record structure for the first record looks like the following. I will first evaluate the position of the record and than create an output with DBCC PAGE
SELECT pc.*, d.Id, d.c1
FROM dbo.demo AS d CROSS APPLY sys.fn_PhysLocCracker(%%physloc%%) AS pc
WHERE d.Id = 1;
In my example the first record allocates the page 168. To examine this page you can use DBCC PAGE but keep in mind that it isn't documented. You have to enable the output of DBCC PAGE by usage of DBCC TRACEON with the TF 3604.
DBCC TRACEON (3604);
DBCC PAGE (demo_db, 1, 168, 1);
The output of the above command shows all data records which are allocated on the page 168. The next output represents the first record:
Slot 0, Offset 0x60, Length 115, DumpStyle BYTE
Record Type = PRIMARY_RECORD Record Attributes = NULL_BITMAP Record Size = 115
The above output shows the record header which describes the type of record and it gives some information about the structure of the record. It is a PRIMARY RECORD which contains NULLable columns. The length of the record is 115 bytes.
The next ouptput shows the first bytes of the record and its logical solution:
10 00 PRIMARY RECORD and NULLable columns
70 00 OFFSET for information about number of columns (112)
01 00 00 00 Value of ID
00 00 00 00 Value of C1
6a757374 Value (begin) of C2
If might be complicate but you will get a very good explanation about the record structures in the the Book "SQL Server Internals" from Kalen Delaney.
The first two bytes (0x1000 describe the record type and its structure. Bytes 3 and 4 define the offset in the record where the information about the number of columns can be picked up. As you may see from the value it is "far far" near the end of the record.
The reason is quite simple - these information are stored BEHIND the fixed length data of a record. As you can see from the above "code" the position is 112. 112 - 4 bytes for the record header is 108. Id = 4 + C1 = 4 + C2 = 100 = ??? All the columns are FIXED
length columns so is it with C1 because it has a fixed length data size!
The next 4 bytes represent the value which is stored in Id (0x01000000) which is 1. C1 is filled with placeholders for a possible value. If we update it with a new value the preallocated space in the record structure will be filled and NO extra space will
be used. So - based on the simple table structure - a growth WILL NOT OCCUR!
Based on the given finding the question is WHAT will cause additional allocation of space?
It can only be nonclustered indexes. Let's assume we have an index on c1 (which is full of NULL). If you update the table with values the NCI will be updated, too. For each update from NULL to Value a new record will be added to the NCI. What is the size
of the new record in the NCI?
We have the record header which is 4 bytes. If the table is a heap we have to deal with a RID it is 8 bytes. If your table is a Clustered index the size depends on the size of the Clustered Key(s). If it is only an INT it is 4 bytes. In the given example
I have to add 8 Bytes because it is a HEAP!
On top of the - now 12 bytes - we have to add the size of the column itself which is 4 bytes. Last but not least additional space will be allocated if the index isn't unique (+4 bytes) allows NULL, ...
In the given example a nonlclustered index will consume 4 bytes for the header + 8 bytes for the RID + 4 bytes for C1 + 4 bytes if the index isn't unique + 2 bytes for the NULLable information! = 22 bytes!!!
Now calculate the size by your number of records. And next ... - add the calculated size for EACH additional record and don't forget page splits, too! If the values for the index are not contigious you will have hundreds of page splits when the data will
be added to the index(es) :). In this case the fill factor is worthless because of the huge amount of data...
Get more information about my arguments here:
Calculation of index size:
http://msdn.microsoft.com/en-us/library/ms190620.aspx
Structure of a record:
http://www.sqlskills.com/blogs/paul/inside-the-storage-engine-anatomy-of-a-record/
PS: I remember my first international speaker engagement which was in 2013 in Stockholm (Erland may remember it!). I was talking about the internal structures of the database engine as a starting point for my "INSERT / UPDTAE / DELETE - deep dive" session.
There was one guy who asked in a quite boring manner: "For what do we need to know this nonsence?" I was stumbeling because I didn't had the right answer to this. Now I would answer that knowing about record structure and internals you can calculate in a quite
better way the future storage size :)
You can watch it here but I wouldn't recommend it :)
http://www.sqlpass.org/sqlrally/2013/nordic/Agenda/VideoRecordings.aspx
MCM - SQL Server 2008
MCSE - SQL Server 2012
db Berater GmbH
SQL Server Blog (german only)

Similar Messages

  • Too much space used on my HD

    Decided to try win 7 ultimate 64, as was just a test installed it on a 80 gb hd ( real 76,6 gb ) I have nothing not-esential installed ( no games ) just Arma 3 installer = 10 gb, checking space on it shows this : 44,8 gb available of 76,6 gb. HOW !? 22
    gb from win7 stuff ?  

    To investigate disk space usage download, install and run Treesize (freeware)
    as Administrator.
    http://www.jam-software.com/treesize_free/
    Place a shortcut to Treesize on your Desktop, right click the icon and select Run as Administrator to open Treesize. You need to run as Administrator to see
    all files.
    Information on Treesize
    http://www.jam-software.com/treesize_free/
    When you open Treesize select Scan from the Menu and you will see a list of drives. Click on C and it will generate a list of Folders.
    Post the names and the sizes of the 6 largest folders and the total at the top of the list.
    Hope this helps, Gerry

  • I allocated too much space on the Windows side when using bootcamp and want to take some space back for the Mac side is there any easy way to do this?

    I allocated too much space on the Windows side when using bootcamp and want to take some space back for the Mac side is there any easy way to do this?

    Purchase and use Paragon Camp Tune

  • All pictures in Photos on Mac syncing with Photos on iPhone and taking up too much space

    Since I downloaded Photos on my MacBook Pro, all the pictures that I had in iPhotos are not showing up on Photos on my laptop AND my iPhone. I used to be able to choose which iPhoto albums to sync with my iPhone and would prefer to do that again. It is taking up way too much space to have them all synced to my phone. Any idea how to choose which pictures I want available on my phone???

    Before the migration to Photos on laptop, I would go to iTunes, Photos, Sync Photos, Selected Albums, and then choose the albums from iPhoto to sync to phone.
    Since I had the problem with all of the photos syncing to iPhone, I un-checked Sync, but they were all still showing up on iPhone.
    I just looked at iTunes and saw this message:
    When I looked last week, the "copy from _______" was not an option. Now I am able to choose the iPhoto albums that I want to sync just as I was before.
    I still don't know why they were syncing when I didn't have that option selected, but it appears Apple has fixed the issue I was having.
    I guess I will continue to use iPhoto rather than Photos on my laptop to avoid this issue again.
    Thank you for your help!!!!

  • Screen came up that Firefox is using too much space?????

    Doing some web browsing and a screen came up saying that Firefox was using too much space. How can I fix this?

    I have found the message useful as a reminder to restart Firefox soon, because of it I am a lot more likely to restart Firefox if leave the room so it will have been restarted automatically by the time I get back. It is measuring memory, but once my CPU time gets near 50 minutes it may soon be 1 hour then 2 hours, I think Firefox is running better now both because Firefox has identified some problems and because of the reminder from AVG.
    I wouldn't advise disabling the warning, and I don't think anyone on the AVG forum thread would be doing it either but here is their own thread:
    *Web Browsers High Memory Usage
    *: http://forums.avg.com/us-en/avg-forums?sec=thread&act=show&id=180124
    Firefox can be quickly restarted with an extension that shuts down Firefox, restarts Firefox, and returns user to where they were automatically. "Restartless Restart" for current Firefox users. Firefox users up to Firefox 3.6.* would have to use the older extension "QuickRestart"
    * Restartless Restart :: Add-ons for Firefox (15.4 KB)<br> https://addons.mozilla.org/firefox/addon/restartless-restart/
    * QuickRestart :: Add-ons for Firefox (34.8 KB)<br>https://addons.mozilla.org/firefox/addon/quickrestart/

  • I selected manually manage music for my iTouch yet it keeps trying to sync to my entire music library.  I do not want that as it is taking up too much space.  How can I stop my iTouch from continuing to try and sync so I can manually manage my music?

    How do I get my iTouch to manually manage my music?  I selected manually manage, yet every time I hook my iTouch to my computer, it attempts to sync and load my entire library.  I do not want the entire library as it takes up too much space and I don't want all of those songs on my iTouch.  What am I missing?  What else can I do? 

    Oops, sorry, I think you probably already did what I suggested (turning off auto synch).
    I have the same question - how to synch, say, just one playlist.
    There is an option to synch only things that are checked. But everything (in every playlist and item, is checked and there doesn't appear to be a box to "uncheck all", nor can you check each playlist individually.

  • I was copying files to my time capsule when it crashed when it was almost finished. Now I am stuck with a light grey folder I can not delete. I would´t care if it wasn´t for the fact the folder is 1 TB size and takes up too much space. I ha

    I was copying files to my time capsule when it crashed when it was almost finished. Now I am stuck with a light grey folder I can not delete. I would´t care if it wasn´t for the fact the folder is 1 TB size and takes up too much space. I have tried turning on and of Hiding Files in Finder and what not with no success. So, how do I delete this folder. Remember, I am not extremely familiar with technical terms.

    I recommend you erase the TC.. it is the easiest and fastest solution.
    In Airport utility open the disk tab and select erase.. choose quick erase.. it will take less than 1min.
    Start again but copy files in small amounts.

  • How do I remove the Icons next to each bookmark on the bookmark toolbar? They take up too much space and all the bookmarks I need on the toolbar dont show up.

    On my bookmarks toolbar, each bookmark has the associated webpage icon next to it. I would like to remove those icons, as they take up too much space.
    Thanks

    The icons, if you are familiar with them or they are obvious, take up less space than the words. You can abbreviate the names down to next to nothing or even nothing.
    To save space and help organization you can group bookmarks into folders on your Bookmarks toolbar.

  • How can I get the photos on my 8gb iPod touch transferred to my Windows computer and removed from my iPod touch? They are taking up too much space.

    I have an 8gb iPod Touch. How can I transfer my photos to my Windows computer and delete them from my iPod Touc? They are taking up too much space.

    See:
    Copying personal photos and videos from iPhone, iPad, or iPod touch to your computer

  • ICloud Photos on my iPad uses too much space

    I updated to iOS 8.3 and enabled iCloud Photo on all my devices and have it enabled on my iMac with the latest OSX Yosemite.  Since then, the Photos app on my iPad is taking far too much space even though I have enabled the optimize storage feature on the iPad.  Is there away to reduce the number of Photos available on my iPad without turning off the iCloud Photo feature? Is it possible to view only a subset of all my photos or is it all or none with iCloud?

    I had the same thought that it would be nice if I could specify a subset of the photos on my Mac to be included in iCloud Photo Library. There isn't an option and the only work around I have found would be to have to Photos libraries on my Mac -- one with iCloud on and the other with it off. Not an easy solution. More details on how to do that: Adjust the size of your Photos library to work with iCloud Photo Library - Apple Support
    You might want to make a suggestion to Apple at https://www.apple.com/feedback/icloud.html

  • Why is webpages I vist not fitting the screen. There is too much space on the left side and I cannot access my scroll bars.

    Seems the pages I visit on the net are pushed more to the right, leaving too much space on the left side. Therefore, I cannot acccess the scroll down or across bars.

    Reset the page zoom on pages that cause problems: <b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    *http://kb.mozillazine.org/Zoom_text_of_web_pages
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • The iCloud Drive folder in Library/Mobile Documents is taking up way too much space on my startup disk.

    The iCloud Drive folder in Library/Mobile Documents is taking up way too much space on my startup disk
    I was hoping my files would stay in the cloud and not take up a ton of space on my machine (only a 128gb SSD).  But while performing an overnight time machine backup I came back to find a "Startup Disk Full" error message.  I only have about 20gb used locally but over 200gb in iCloud Drive at the moment.
    Is there a way to clear the cache so my files stay on iCloud and not hogging space on my SSD? Or a way to redirect this library to my 2nd hard drive?
    I'm using a 15" mid-2012 Macbook Pro with a 1TB hard drive and I've replaced the optical drive with a 128gb SSD for my OS (which is where my library is, hence the difficulty).
    Thank you!

    While puttering around after posting this I think I found my personal solution here: http://macs.about.com/od/diyguidesprojects/qt/Move-Your-Home-Folder-To-A-New-Loc ation.htm
    I'm just going to move my home folder to my 2nd internal 1TB hard drive to solve my problem.
    But my question remains, how can we minimize the amount of local space iCloud Drive ***** up?  I wanted to get the rumored new macbook air that might come out next year but this is a big turn off if iCloud drive is going to overwhelm the SSD in the AIr.

  • Apps taking up too much space on my computer harddrive?

    Hi guys,
    Whenever I hook my iPad & iPhone up to iTunes it automatically starts to upload all of the apps from both devices onto my computer. This wouldn't be such a problem, but between the iPhone and the iPad, it takes up around 40 GB of space from apps all by themselves. I store music/videos on an external harddrive so I'm not completely starved for harddrive space but I was wondering if someone could tell me what I can do to keep my iPad/iPhone apps from eating up too much space on my computer?
    Seems like I should be able to avoid having the iPhone/iPad (I use both) upload and backup all of my apps to my computer through iTunes but I also tried doing a backup straight ti iCloud and it didn't do the trick.
    Does anyone have any answers on this please? Thanks.

    400 apps taking up 13.6Gb so I get an estimate of 1,175 (wow I have some bulky apps!) but 40Gb sounds like quite a haul.
    A couple of things come to mind. First is that occasionally iTunes can neglect to delete the old copy when apps are updated so you could have some orphaned files in your Mobile Applications folder.
    Second, your apps should be stored in the same location as your music and movies but I'm guessing from what you've written that they're not. This means you are likely to have a split library with the database and supporting files on your internal drive and media in another folder, but in the old school layout. Assuming you are happy letting iTunes organize your files (and you have a backup) using File > Library > Organize Library > Rearrange files in the folder <Media Folder>, followed by File > Library > Organize Library > Consolidate files will sort that out. You'll have to delete the now redundant copies of the apps on your internal drive. The good news is that this will have dealt with any orphaned apps.
    In the long term you might want to consider making your library portable.
    Note switching to iCloud backup should not remove any content from your computer. I suspect purchases still get transferred when syncing but I've not tested it.
    tt2

  • What is the best way to manage my iPhoto, which is taking up too much space on my MacBook Pro?

    What is the best way to manage my iPhoto, which is taking up too much space on my MacBook Pro?
    Specifically, I'd like to keep some of my favorite pictures on the laptop while moving the rest to an external hard drive. Is there a way to tag just a few pictures inside an event/album as "favorite", while storing the rest in an EHD, but still keep them connected to the same event/album? I'd like to have just the favorite pictures on the laptop, but when I have the EHD connected,  be able to view all my pictures in the same place, and not have to browse through separate hard drives. Ideally, whether or not a picture is designated as "favorite" will determine where it resides.
    Is this at all possible?
    I have only 7 GB left on my HD and I'm desperately needing a solution!
    Thanks!

    You need two libraries to do this. One on the external with all your Photos. One on the internal with a subset - your favourites. You do it this way to make backing up easier - that is, back up the library with everything, so you're only backing up one.
    Make sure the drive is formatted Mac OS Extended (Journaled)
    1. Quit iPhoto
    2. Copy the iPhoto Library from your Pictures Folder to the External Disk.
    Now you have two full versions of the Library.
    3. On the Internal library, trash the Events/albums/photos you don't want there
    Now you have a full copy of the Library on the External and a smaller subset on the Internal
    Some Notes:
    As a general rule: when deleting photos do them in batches of about 100 at a time. iPhoto can baulk at trashing large numbers at one go.
    You can choose which Library to open: Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library'
    You can keep the Library on the external updated with new imports using iPhoto Library Manager

  • Too much space after form

    There is too much space after the form:
    http://zooop.net/birch_center/
    I can control the space by adding a height tag in this tag:
    <iframe src="
    http://www.birchcenter.com/OpenNewsletter/includethis.php"
    frameborder="0" width="170" scrolling=no style="border:0px;
    font:Verdana, Arial, Helvetica, sans-serif;
    color:#666666"></iframe>
    But when users enlarge their text either through their OS or
    their browser, the "Subscribe" buttons sinks behind the text after
    it, and is not functionlal.
    Does anyone know why there is so much space after the form
    and how I could get rid of it?
    Thanks very much,
    Emilie

    > Does anyone know why there is so much space after the
    form and how I could
    > get
    > rid of it?
    Many HTML tags have inherent margins, and <form> is one
    of them. Use CSS to
    control it -
    form { margin:0; padding:0; }
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "zzzeeep" <[email protected]> wrote in
    message
    news:f0900b$h4f$[email protected]..
    > There is too much space after the form:
    >
    >
    http://zooop.net/birch_center/
    >
    > I can control the space by adding a height tag in this
    tag:
    >
    > <iframe src="
    http://www.birchcenter.com/OpenNewsletter/includethis.php"
    > frameborder="0" width="170" scrolling=no
    style="border:0px; font:Verdana,
    > Arial, Helvetica, sans-serif;
    color:#666666"></iframe>
    >
    > But when users enlarge their text either through their
    OS or their
    > browser,
    > the "Subscribe" buttons sinks behind the text after it,
    and is not
    > functionlal.
    >
    > Does anyone know why there is so much space after the
    form and how I could
    > get
    > rid of it?
    >
    > Thanks very much,
    > Emilie
    >

Maybe you are looking for

  • BW:Inventory stock Report issue based on Vendor and PO number

    Dear Guru's. Requirement is to report different inventory  stock's (Total Stock, blocked stock, stock in transit..etc) based on plant, material, storage location, vendor and purchase order in BW. For Example: Plant material Stock in Transit Total Sto

  • How can I remove a non=working windows partition from my mac?

    Alright so when I got my computer around 3 years ago my mom installed Windows on it. Sadly it didn't work and there was an uninstall so it uninstalled it, but now I have this 10 GB windows partition that's still there but I can't boot up on it and it

  • DVR not working.

    I was watching a recorded show this morning on my QIP6416 DVR.  The show froze while watching.  I could not hit stop, exit, or anything else to get out of the frozen dvr playback.  The only thing that would work was hitting power on the STB.  It turn

  • How can i fix my itunes because i can't see my ipod on it but i can see him in windows documents ?

    i can't put music on my ipod touch help meee itunes can't find my ipod touch so what do i need to do i already reinstalled itunes but same probleme

  • MM-SUS: PO not sent to SUS

    Dear experts, We are on SRM 7 and ECC 6 EhP 4 and we want to configure the MM-SUS scenario. We have done the following: - Configured scenario SE_Service_Procurement in Integration Directory in XI system - Activated Business Functions ESOA_OPS01, LOG_