+ Reply to Thread
Results 1 to 5 of 5

MS Access - Compact and Repair ??

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,010

    MS Access - Compact and Repair ??

    .
    I am not as familiar with Access as I am VBA/Excel and VB.

    I have a database project constructed in VB6. It stores records in an Access table/sheet.

    #1 - Is it necessary that this arrangement require a periodic Compact/Repair process since Access is only storing the data ?

    #2 - I have read different websites that talk about Compact/Repair when the database program is closed and other sites that speak to C/R as the last thing BEFORE the database program closes.
    Which process is better and why ?

    #3 - For some reason (maybe my VBA / VB experiience) I an leaning toward the C/R as a 'before closed' process of the database. Will this produce future errors ?

    The project uses Microsoft ActiveX Data Objects.

    Thank you for your assistance !

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: MS Access - Compact and Repair ??

    My information may be antiquated, but the way some databases used to work was on what I call an "ebb and flow" principle. If you add 10,000 records the database uses 10,000 records worth of space. If you then delete 5,000 records, the database still occupies 10,000 records worth of space. It's just that 5,000 of them are "unoccupied." These unoccupied slots get filled in when new data is added until they are all filled and then the database starts growing again. So the database always occupies the high water mark.

    This was an issue when disk size was a consideration. It is not so much now.

    I am not so sure how having vacant records affects performance. Does the database have to "stumble over" these empty spaces and does that slow it down. I don't think this matters much if the database is properly indexed. It does not have to "knock on the door" to see if anybody is at home. It knows where every piece of data lives. At most, it has to skip physical spaces on the disk.

    Compacting the database is analogous to defragmenting a disk; it pulls the fragmented pieces together. The excess space is then deleted.

    I imagine that even with modern processors there would be some improvement in performance.

    Having a lot of data isn't the issue. Adding and deleting a lot of data is the issue. If you are continuously adding data without deleting any of it, then compressing it won't do much good.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,010

    Re: MS Access - Compact and Repair ??

    .
    Thank you for your response.

    Sounds like it won't be much of a problem 'cuz the project is a stand alone, desktop version. Used by one person mainly for input and periodic review without editing.
    I don't forsee the database being larger than 100,000 - 200,000 records.

  4. #4
    Registered User
    Join Date
    07-12-2018
    Location
    Greater New Orleans, Louisiana, USA
    MS-Off Ver
    2010
    Posts
    23

    Re: MS Access - Compact and Repair ??

    Don't know if you've gone very far on this, but C/R is always a good idea. As pointed out by dflak, when you "churn" your data in Access, you create records but do not actually delete obsolete records. This is because of the way Access uses dynamic memory. In essence, you really can only do one of two things to a record - thread it into the table structure or unthread it. Append (Insert) and Update create records - either new for Append or updated copies for Update. Then they thread the new copy into the list and remove the old copy at the same time. But the way this is one, the removed record creates a "gap" in memory so that, when a lot of churning occurs, a memory map of what is actually in use will start to look like a Swiss cheese. What the C/R does is it rebuilds the lists of records for each table by copying them in a way that fully occupies memory with no gaps. I.e. squeezes the holes out of the cheese.

    As to performance, it is rarely an issue EXCEPT that if you had a really large DB and started to do some churning, you would find that the system was working harder to find places to put things. A C/R does this: It makes the file physically smaller. If you also have disk compression turned on as a weekly thing, then making your file smaller and contiguous gives you a better chance to find records quickly because the compressed files require fewer system "extent pointers" which means less processing. Are you likely to actually SEE this performance boost? Not on modern computers, since any spinning disk still requires head movement that will be measured in milliseconds but 1 msec is typically over a million instructions. The difference in processing an extra extent pointer is pretty much lost in the shuffle.

  5. #5
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,010

    Re: MS Access - Compact and Repair ??

    .
    Thank you Doc-Man for your insight.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Compact & Repair Backend Database
    By PSSMargaret in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2017, 06:49 AM
  2. Filters blank and compact repair not working
    By grifter in forum Access Tables & Databases
    Replies: 1
    Last Post: 05-25-2016, 04:08 PM
  3. Opening Access DB with /compact operator
    By koltregaskes in forum Excel General
    Replies: 1
    Last Post: 10-03-2012, 08:59 AM
  4. Compact/Repair Access Database
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2009, 04:41 AM
  5. Replies: 1
    Last Post: 12-02-2005, 05:00 AM
  6. Compact Workbook
    By naiveprogrammer in forum Excel General
    Replies: 3
    Last Post: 10-24-2005, 10:05 PM
  7. [SOLVED] Compact
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-09-2005, 07:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1