Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compacting a Jet Database

Status
Not open for further replies.

sacsac

Programmer
Dec 10, 2000
177
GB
In VB2010 I compact a Jet database using JRO.CompactDatabase(........
This all works just fine, and if my database is e.g. 80MB to start with, I typically get a compacted db of around 10MB. All good so far.
But here is a strange thing - if I use WinZip to further compress the original 80MB db it goes down to about 0.5MB, but if I zip the 10MB compacted db it does not compress at all, remaining at 10MB. Any ideas on this?
 
In very, very, very simple terms a compression program will look for long series of repeated bytes and store those bytes in an index table. Whenever it comes across them in the file it replaces them with the index. The more usefull repeated series it finds the greater the compression. Obviously it is far more complicated than than but I don't know the exact details. When you compact a Jet database it removes all unnecessary stuff, such as temp/runtime queries, deleted records etc. Therefore there is far less duplication within the file for the compression program to work with. If such a program determines that when its index table is included the resultant file will be no smaller (but possibly larger) than the original it doesn't bother withe the compression.


Hope this helps
 
Thanks softthemec. That all makes sense, but the end result seems strange - a larger file zips up into a smaller file than its smaller version! What I am trying to do here within my application (which stores data in many different Jet databases), is give the user the opportunity to compress them to save on disc space. I also want them to be able to routinely email the databases to me (zipped?), so for that reason I wish to get the size as small as possible. It seems ironic that I appear to be better off in terms of a small email attachement by NOT compacting the Jet database first, but just zipping instead!
 
Those are two entirely different things.
CompactDatabase is not a compression function.
CompactDatabase simply removes deleted/dropped records and objects from the db and in doing so, reduces the size of the bloated database.
 
Maybe I have not explained this very well CP60 - I fully understand what you are saying, but my issue is this: my original DB is 80mb, and if I Zip (using WinZip or similar) this, it compresses to 0.5mb, which is ideal to send as an email attachment. However, if I have previously Compacted the db to maximise its efficiency it will be about 10mb in size, but then if I attempt to Zip it, it will barely compress, remaining at about 10mb. So it seems that if I want to be able to use a zip utility to make a small file to email, then I must avoid Compacting the db. This is what does not make any sense to me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top