Why is the defragmenter needed?As in other file systems, Informix partitions may have many extents, whichare contiguous blocks of storage used to store a portion of the partition.In Informix, partitions reside in dbspaces. After a period of updateactivity, a dbspace may get highly fragmented, and an extent of a desiredlength may not be available, so a shorter, non-optimal length, extent maybe used. Searching for a long extent in a fragmented dbspace can take asignificant amount of time since a dbspace may contain many small freeextents that are searched over; this time can be substantial. Shortextents cause the server to stop prematurely if large block I/O (lightscans) is occurring. In addition, the operation to map logical addresses tophysical addresses consumes significant CPU resources and takes longer. Formaximum efficiency, frequently accessed tables should have as few extentsas possible.
The operations that may take longer with short extentsinclude: finding extents, mapping logical to physical addresses, lightscans, archives, read-ahead, and checkpoint flush.Merging extents to get fewer extents (defragmentation) is beneficial tocustomers who have a large number of extents in a partition and are likelyto run into the partition page overflow problem. The Informix 11.70introduces extent map overflow pages so the maximum number of extents is high(32,767); however, using extent map overflow pages reduces efficiency.Users with knowledge of Version 7.3x may remember the oncheck -meutility. The oncheck -me utility was a limited-use defragmenter for 7.3xservers. It has a number of deficiencies.
Solutions and help with Piriform Defraggler. Notes: While we believe this information up to date and accurate, FAQware is not responsible for any inaccuracies.
Its primary deficiency is thatit takes an exclusive lock on the table. In addition, oncheck -me cannotrecover from server crashes. With the 11.70 defragmenter, extents aremerged while the partition is being read and updated, and full crashrecovery is provided. Archives, reads, and updates can be run in parallelwith the 11.70 defragmenter. What does the defragmenter do?The defragmenter merges multiple smaller extents to get longer contiguousextents for a partition, thereby reducing the total number of extents in apartition. If a contiguous extent of the appropriate size is available,then a partition always ends up with a single extent after thedefragmenter completes, provided that you do not add extents to thepartition while the defragmenter is running. The partition could be a dataor index partition.
The defragment operation is an online operation. Thedefragmenter does not take an exclusive lock while doing the defragoperation, hence the partition is available for other operations.Informix 11.70 also provides compress, repack, and shrink. How does the11.70 defragmenter differ from compress, repack, and shrink?. Compress reduces the size of data being stored, thereby creatingunused space in the partition.
Repack moves rows from the end of the partition to the empty pagespace present in the upper end of the partition. Shrink releases extents that have been emptied back to thedbspace.So compress, repack, and shrink might be able to reduce the total number ofextents for a partition, just like the defragmenter. However, compress,repack, and shrink operate at the row level; the defragmenter operates atthe extent level. How does the defragmenter work?When the defragmenter is invoked on a partition, it first checks to ensurethat the defragmenter is being run on a valid partition type and that noconflicting operations, such as compression, are running concurrently withthe defragmenter.
(Conflicting operations result in the defragmenterreturning an error code.) The defragmenter then checks to see ifdefragmentation is necessary. If the partition has one or zero extents,then no defragmentation can be performed; the defragmenter returnssuccessfully with no error code set.When the defragment operation begins, an entry in the table accessed by thecommand onstat -g defragment is made. Thepartition is then 'frozen' (in other words, only the current number ofextents will be considered for defragmentation). Extents added while thedefragmenter is running will not be eliminated. Note that only onedefragment operation per dbspace is currently allowed.The defragmenter then goes into a loop, wherein it first attempts to locatecontiguous free space in the dbspace that covers two or more partitionextents, and then allocates this space to the partition and moves the datafrom the old extents into the new extent. Ideally there is a large enoughcontiguous block of storage to cover all the extents in the partition.
Inthis case, the result will be a single extent. Adding a chunk to thedbspace before running the defragmenter can help assure this. If thelargest free extent cannot cover two or more partition extents, thedefragmenter sets an error code and returns.Free space at the end of the partition is considered as space that needs tobe covered by the defragmenter. If this is undesirable, then run shrinkbefore running the defragmenter on a partition.Once the defragmenter finds a free extent that can cover two or morepartition extents, it moves pages from the old extent into the new extent.The defragmenter uses the buffer pool for this movement in order to keepthe data in sync with other uses.
If buffer pool usage is a concern, thenrunning the defragmenter at a non-peak time is recommended. After eachpage move, the partition is available for operations, such as updates. The'lock-out' time is kept to a bare minimum so that users cannot tell thedefragmentation is running.
Upon each page move, a short log record iswritten. When an original partition extent is emptied, the transaction iscommitted, and the move is finalized.
![Defraggler Defrag Aborted Defraggler Defrag Aborted](http://i42.tinypic.com/35bv39e.png)
Defragmenter transactions are short;there is no possibility of a long transaction occurring. Checkpoints arenot blocked by the defragmenter.The partition may contain empty pages. These usually occur at the end ofthe partition, and these pages are not copied.For each defragment.
A message appears in the online log at the start ofdefragmentation.A crash while the defragmenter is running results in only the lasttransaction being aborted. In most cases, most of the work is committedand does not have to be redone. The defragmenter will not automaticallystart up again if a defragmentation operation was in progress at the timeof crash.
During fast recovery, all committed transactions are redone,partially completed transactions are aborted, and the dbspace is restoredto a consistent state. The oncheck -ce commandcan be run on the dbspace and no 'holes' in the chunk should be present.Use oncheck -pt to check on the number ofpartition extents after defragmentation.Certain special operations on a partition conflict with the 11.70defragmenter. These conflicting operations include: compress, repack,shrink, alter, online index build, truncate, and drop. The defragmentermay not be run on the partition partition, secondary server, or a temporary table.
Defragmenter usage examplesThe defragmenter may be invoked using theexecute function syntax in the dbadmin databaseor through the OAT interface. Specifying a table name results in allfragments of that table being defragmented. You may specify a partitionnumber (partnum), in which case, only that partnum will be defragmented.In the 11.70 UC2 and later versions, you can specify an index namedirectly. In 11.70 UC1, you can defragment indexes but you must specifytheir partnum.The execute function syntax can be accessedthrough dbaccess, or through a ESQL C or Java program.Let's use the sales demo database tables provided with Informix as anexample table. You can create this demo database by running the scriptdbaccessdemoud in the sqldist bin directory.(For additional information, see the IBM Informix DB Access Users Guidefor information on how to set this up.) Unfortunately, tables created bydbaccessdemoud are short and sometimes mayonly have one extent in certain circumstances. To view the extents in thistable run the following command: oncheck -pt salesdemo:salesThree extents can be seen in this table. If there was only one extent, thenthe defragmenter will not actually defragment it, but the defragmenterwill return success in this case.
For example, in theoncheck -pt output, you should see somethinglike the output shown in Listing 1: Listing 1. Extent list ExtentsLogical Page Physical Page Size Physical Pages0 1:186118 8 88 1:186132 8 816 1:186168 16 16This indicates that the sales table contains three extents. The firstextent of length 8 begins at page 186118. Let's defragment this partitionusing a dbadmin command. In dbaccess, selectthe sysadmin database. In dbaccess, run the command: Listing 2. Defragment the partition execute function task ('defragment', 'salesdemo:sales');or if you prefer or need to defragment an index or one fragment of a table do:execute function task ('defragment partnum', '1049104');You can find the partitions partnum in the oncheck -pt output.After defragmentation another oncheck -pt can be used to verify the number of extents inthe partition.
In this example, you should see one extent.ExtentsLogical Page Physical Page Size Physical Pages0 1:186184 32 32 How to monitor the defragment operationYou can monitor the defragment operations by using theonstat optiononstat -g defragment. Thiscommand must be run while the defragmenter is active on a partition toshow the defragment operation in progress. Since the defragment operationmay run quickly, especially for smaller tables, the defragment informationmay be available for only a short period of time.The output of the command looks like this: Listing 3. Output of onstat -g defragment onstat -g defragmentDefrag infoid table name id dbsnum partnum status substatus errnum62 test:informix.tab1 55 3 3145730 SEARCHINGFOREXTENT 0 062 test:informix.tab1 55 3 3145730 MERGINGEXTENTS 0 0The different types of status are:SEARCHINGFOREXTENT, MERGINGEXTENTS, DEFRAGCOMPLETED, DEFRAGFAILEDIn the case of DEFRAGFAILED- it gives the errnum.
In all other cases errnum is 0. Summary of limitationsBe aware of the following limitations:. Only one defragment operation is allowed on a partition at atime. Only one defragment operation is allowed on a dbspace at a time. The defragment operation aborts if one of the following operations isalready occurring on the same partition:. Truncate. Drop.
Compress, repack, shrink. Uncompress. Online index build.
AlterConclusionThe Informix 11.70 server has a comprehensive set of tools that worktogether to optimize utilization of storage and ensure the highest accessefficiency. These tools include compression, pack, shrink, and defragment.The defragmenter is one component of this tool set that is particularlyuseful for partitions residing in heavily updated dbspaces.
If a table isused heavily and is frequently updated, then you should considerperiodically running the defragmenter on it.
Defragmenting your hard drive is a necessary part of owning a computer. It's why Windows now turns on its onboard defragmenter by default.
However, the options in that program are limited. Defraggler outdoes it in every way imaginable. With quicker performance, more features and detailed statistics, this defragmenter is the only one you need.One of the standout features Defraggler offers is that it can defrag files individually. If one or two of your programs are struggling, you can specifically target them in the process during a quick defrag. This increases their power as well as your computer's overall speed. When you're examining your drive, Defraggler gives you a clear, color-coded map.
That, in addition to detailed info about your hard drive's overall health, is delightful for power users while being useful for the average folks. Though the program can sometimes hang at zero percent for minutes on end, it actually moves faster than most defragmenting programs when it's working on your drive. With quick, boot, and low-priority defrag modes, it will never get in your way. You can use your computer however you want as it runs.With an unmatched feature set and quick defragging, it's hard to recommend any other defragmenting program. Even though there's a professional version of Defraggler that costs $30, this program isn't missing anything that could be worth that download. Plus, unlike just about every other program, it never asks you to download the full version.
It's safe to say you'll never need to go back to the default option in Windows again. Reply by tower4guy on March 20, 2016Have to agree with Randy Bell as this utility doesn't mess with the parts of your BIOS that are affected. I've been using this utility with: Windows 7, Windows 7 Pro, Vista(wife's machine before upgrading to Win 7 Pro also) and now Win 10. Also on an Acer laptop with a very small HD which was upgraded from Win 7 to Win 7 Pro and now Win 10. Never, ever had any problems with this program.
Of course rather than just installing it I took the time to read all the 'ReadMe' files and experiment with various settings. With all of our machines running Win 10 I also use the same settings regardless of the machine maker and have zero problems yet they all get defragged. A lot depends on the sizes of the items being defragged too.set it too large and you've wasted your time defragging. I also manually defrag using the files section-high-light a file then scroll down however # of files you want(you'll learn how many to to do) then press Shift then left-click on a file, then defrag. Reply by Randy Bell on April 14, 2015this is a mild rebuttal to the 'Garbage' reply:(i) defragmentation cannot change the occupied and free space of your hard drive - it merely rearranges the disk clusters so that clusters belonging to an individual file are contiguous.
(ii) I've never witnessed any defragmentation software affect the system time clock, that is strange.You must have other issues going on, maybe some viral infection, something, to cause this weird behavior. I don't see how a defragment utility, which focuses only on the file system and allocated clusters for each file, could affect the BIOS?? Reply by on October 11, 2014My opinion, 'Garbage'There are no pros.Screwed up my computer.
Would not boot up.I have windows 8.1 This software screwed up my date an time in my Bios, causing my computer,not to boot into my desktop,till I reset the date an time in my Bios. Once I was able to get to my desktop, I noticed my time clock was off by 2 hours.So, I had to reset the time. Than, I noticed the month was set to 2 months earlier, which I also had to correct.
I do remember, during the installation, it asked if I wanted to delete the Microsoft Windows Derangement-er. I'm glad I did not choose that option. I also recall, when I ran this program, an when it had finished, that I had now less disk space on my hard drive, than what I had before I ran this program. This is all backwards. Had it worked, my C drive (hard drive) should have gained more storage space, not lost space.
Reply by curiousgeorge13 on September 2, 2014Did you read the messages when it stopped defragging? Did you see that it will not defrag running system files, because if it did, the computer would crash big time! Try to delete, or even look at C:/Pagefile.sys. BSD every time!The only way to do a 100% defrag is when the system boots up & before Windows kicks in. That's one of your options in the Defraggler menu. See: Settings - lets you do it once, or every time, or never.
Suggest you read the help file.