Compressing Database Files - Anomalies

richlocus
2StarLounger
Posts: 149
Joined: 03 Oct 2015, 00:30

Compressing Database Files - Anomalies

Post by richlocus »

Hello:

Here's a mystery.  I have a database that has the "Compact" on close set in the options. 
When I open the original and close it, and it has a compacted size of about 6.2 Megabytes.

Now... I make a copy of the original database.  I would expect the same size after the close and compact.

But it is not!  The copy compacts to 5.9 MB.

Just to make sure, I open and close the original file I copied and it still has 6.2 Megabytes.

Why is that?

Regards,

Rich Locus

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Compressing Database Files - Anomalies

Post by HansV »

In the first place, there is an element of randomness in the compact algorithm. 'Compact on Close' is turned on in one of the databases that I use almost every day. Although the number of records in the tables only grows (I never delete records in this database), the compacted size sometimes goes up, sometimes down.

In the second place: did you copy the database file, or did you import all database objects into a new database?
Best wishes,
Hans

richlocus
2StarLounger
Posts: 149
Joined: 03 Oct 2015, 00:30

Re: Compressing Database Files - Anomalies

Post by richlocus »

Good morning Hans!!
All I did was right click the closed Access Database file, select Copy and then Paste. It was pasted into the same directory as the original (Windows adds the "copy" notation to the copied database.
Thanks!
Rich Locus

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Compressing Database Files - Anomalies

Post by HansV »

I guess it's down to the randomness in the compact algorithm.
Best wishes,
Hans

richlocus
2StarLounger
Posts: 149
Joined: 03 Oct 2015, 00:30

Re: Compressing Database Files - Anomalies

Post by richlocus »

The mystery of the internals :)