473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MDB Space Usage Growth

I have a process which runs automatically once a day looping through a set of table names deleting all the data from the table (DoCmd.RunSQL "DELETE * FROM " & MyQry!Name) and then importing data from CSV files (DoCmd.TransferText acImportDelim,...) back into the table. Some of the tables are extremely large.

The VBA code and the data are on separate MDBs. I am using Access 2002-2003 file format.

When the data MDB is fully compacted it is about 280-290MB. After one nightly processing run the database has grown to over 800MB.

Questions:
1) Doesn't Access reuse space if a table is deleted?
2) Is it possible that Access is maintaining a temporary table of deleted records which is causing my MDB to grow? If yes, can I tell Access not to maintain this table? If yes, how do I tell Access not to maintain this table?
Jan 4 '07 #1
15 3849
Killer42
8,435 Expert 8TB
1) Doesn't Access reuse space if a table is deleted?
Nope. :)

2) Is it possible that Access is maintaining a temporary table of deleted records which is causing my MDB to grow? If yes, can I tell Access not to maintain this table? If yes, how do I tell Access not to maintain this table?
Like much database software, Access simply ignores the wasted space, for performance reasons. To clean it up, you have to compact the database. This can be done manually under the database tools menu (it's called "compact and repair"), or from code. NeoPa has posted code here to do the job - try a quick search on something like "NeoPa compact database".

Note that probably the best time to do the compact is immediately after your delete. With nothing in the tables, compacting the database will be very quick. You could do it after the import, but then it has to copy your 300Mb of data again. You see, compacting basically copies all current data (plus forms, etc.) to a new database, which leaves behind the deleted records. Then it deletes the old one and renames the new one. So the less there is to copy, the better.
Jan 4 '07 #2
While I understand that Access is ignoring the MDB space that was used by the tables that were deleted, I am not certain that fully explains the quick growth in space usage. The data that I am loading does not increase in size significantly over time. I would therefore expect a fully compacted MDB of 380MB to about double in size after a delete and reload processing run. What I am seeing is an immediate jump to the 2GB limit.

I will say that this does not happen every time we make the processing run. For instance the last time it hit 2GB I got everyone out of the MDB, compacted it, and then had the reload process run. It jumped from 380MB to 800MB. Yesterday afternoon I compacted the MDB to 380MB and this morning it had jumped to 2GB.

This MDB is used by people in the USA and in Europe. I have no way to ensure no one is using the MDB at the time the process is suppose to run. Is it possible the problem is caused by someone actively or inactively using the MDB at the time the delete and reload process runs?
Jan 5 '07 #3
Additional information.

This is a reporting database. Aside from my once a day delete/reload of the tables, very little table updating is done by users.
Jan 5 '07 #4
Killer42
8,435 Expert 8TB
While I understand that Access is ignoring the MDB space that was used by the tables that were deleted, I am not certain that fully explains the quick growth in space usage. The data that I am loading does not increase in size significantly over time. I would therefore expect a fully compacted MDB of 380MB to about double in size after a delete and reload processing run. What I am seeing is an immediate jump to the 2GB limit.
Oh! Well, that's a different story. You said it was growing to about 800MB, which seemed annoying but not unreasonable.

I will say that this does not happen every time we make the processing run. For instance the last time it hit 2GB I got everyone out of the MDB, compacted it, and then had the reload process run. It jumped from 380MB to 800MB. Yesterday afternoon I compacted the MDB to 380MB and this morning it had jumped to 2GB.
That is odd. However, I suspect splitting the database may be part of the answer. I think reporting often causes a lot of temporary stuff to be created (which I think you suggested originally). Maybe people are creating lots of temporary copies of the data in your database, or something.

This MDB is used by people in the USA and in Europe. I have no way to ensure no one is using the MDB at the time the process is suppose to run. Is it possible the problem is caused by someone actively or inactively using the MDB at the time the delete and reload process runs?
I'll have to defer this to the real Access experts here.

I will say again, though - if you haven't already, I'd suggest splitting the front-end user interface) from the back-end (data). That way, hopefully any temp stuff the users create will be in their own front-end database and won't all be lumped in together.

One thing my be worth noting - I'm almost certain you cannot compact/repair unless you have exclusive use of the database.
Jan 5 '07 #5
Killer42
8,435 Expert 8TB
... I would therefore expect a fully compacted MDB of 380MB to about double in size after a delete and reload processing run. What I am seeing is an immediate jump to the 2GB limit.
I also wanted to say that while 2GB does seem extreme, I would expect it to increase considerably more than the 380MB. I do large-ish imports to a big Access database fairly frequently, and I always compact afterward because it does leave a lot of wasted space. My guess is that it uses a lot of space rearranging indexes and so on.
Jan 5 '07 #6
NeoPa
32,556 Expert Mod 16PB
Code found in this thread (Compact / Compress Access File using code)
I've never really understood why Access gets so bloated (ever since Access 2000). Killer's advice is about right but I'm not sure what to do about never having the database available and unused.
You could try Compacting to a different file (the code supports that) then renaming it when it's not in use - can be hard to arrange though depending on usage.
Jan 7 '07 #7
Killer42
8,435 Expert 8TB
Code found in this thread (Compact / Compress Access File using code)
I've never really understood why Access gets so bloated (ever since Access 2000). Killer's advice is about right but I'm not sure what to do about never having the database available and unused.
You could try Compacting to a different file (the code supports that) then renaming it when it's not in use - can be hard to arrange though depending on usage.
Yes, as long as there is absolutely no chance that someone needs to update the database in the interim, you could compact/repair to a second database, then have a process that keep trying to switch names around until it succeeds. Interesting question - is it possible to rename a database file that someone has open? You might initially think "of course not!" but think about it - once the file is open, the name is really immaterial.

Depending on how the Access-based system works, you could also implement things such as throwing out all current users, warning users to please log out, automatically connecting users to the latest in a series of db files, etc etc etc.
Jan 8 '07 #8
NeoPa
32,556 Expert Mod 16PB
Renaming open files, though an O/S issue rather than an Access one, is not possible in Windows. This is regardless of the type of open (Access opens for Read/Write always of course).
Jan 8 '07 #9
Code found in this thread (Compact / Compress Access File using code)
I've never really understood why Access gets so bloated (ever since Access 2000). Killer's advice is about right but I'm not sure what to do about never having the database available and unused.
You could try Compacting to a different file (the code supports that) then renaming it when it's not in use - can be hard to arrange though depending on usage.
Thank you for the link to the compaction code.

Remember I have a front-end MDB (MDB1) and a data MDB (MDB2). Now my question is:

I know you can start Access standalone and compact MDB2 and you can open MDB2 in Access and compact it in place. However, can MDB1, which deletes and reloads the tables and therefore has the tables from MDB2 linked (attached) to it, run the compaction code against MDB2? Another way of asking this question is: If I cannot compact MDB2 when someone else has it opened via their use of MDB1, can I compact MDB2 when I have it opened from MDB1?
Jan 8 '07 #10
NeoPa
32,556 Expert Mod 16PB
You will need to test but I think the answer to that is :
"As long as you're not accessing any of the linked tables at the time."
Jan 8 '07 #11
Killer42
8,435 Expert 8TB
You will need to test but I think the answer to that is :
"As long as you're not accessing any of the linked tables at the time."
I may be wrong, but my experience with this seems to be that as long as you have a database open which is linked to it, it's considered open.

In terms of this example, that would mean that (AFAIK) you can't compact DB2 as long as anyone has DB1 open. As you said though NeoPa, this would need to be tested.
Jan 8 '07 #12
Killer42
8,435 Expert 8TB
Renaming open files, though an O/S issue rather than an Access one, is not possible in Windows. This is regardless of the type of open (Access opens for Read/Write always of course).
Not if you say to open it read-only. Or if the file has the read-only attribute on when Access comes to open it. That might be a good idea, for the general users, if they don't need to update it.
Jan 8 '07 #13
NeoPa
32,556 Expert Mod 16PB
I may be wrong, but my experience with this seems to be that as long as you have a database open which is linked to it, it's considered open.

In terms of this example, that would mean that (AFAIC) you can't compact DB2 as long as anyone has DB1 open. As you said though NeoPa, this would need to be tested.
I compact my linked databases with code in my Front-end database every month. I think that means it works (at least from Access).
I should clarify - I do compact to a differently named file before renaming it back. As long as nothing is currently accessing data from the database being compacted, it is not kept open by Access.
Not if you say to open it read-only. Or if the file has the read-only attribute on when Access comes to open it. That might be a good idea, for the general users, if they don't need to update it.
I didn't think it would open if set to R/O but I tested it & it does so...
I don't believe you can rename it though, as - as I said before - the O/S itself won't allow a rename if there are any processes that have it open (R/O or otherwise).
Jan 8 '07 #14
Killer42
8,435 Expert 8TB
I compact my linked databases with code in my Front-end database every month. I think that means it works (at least from Access).
I should clarify - I do compact to a differently named file before renaming it back. As long as nothing is currently accessing data from the database being compacted, it is not kept open by Access.
Um... you didn't just imagine it every month, by any chance? :)

Actually, I'm glad to know that's possible; I might make use of it in the import procedure in my gigantic database. (I might also split into smaller chunks from now on, as compacting a gigabyte or so can take a while, especially on a network drive.)

I didn't think it would open if set to R/O but I tested it & it does so... I don't believe you can rename it though, as - as I said before - the O/S itself won't allow a rename if there are any processes that have it open (R/O or otherwise).
Fair enough. I did know for certain that you can open them when they're R/O, as I do it all the time. You know my biggy is split into chunks. Well, I keep all but the latest chunk R/O for added safety.

I had been assuming you would turn off the R/O attribute before trying to rename.
Jan 9 '07 #15
AricC
1,892 Expert 1GB
If you have people adding/editing/deleting from the database in the US and EU maybe you should think about MSSQL or something where you can lock the tables during updates. Are you having problems with data corruption?
Jan 9 '07 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dave Serrano | last post by:
I have a question about altering tables and growth of the database and transaction log. I have a database which is approximately 35GB. I had to make a change to a column in the largest table...
1
by: John Jayaseelan | last post by:
Hi, Received the following error during index creation of the tables. The data & log files are set to 'unrestricted growth' and enough space available on the disk. Any reasons? ___________...
1
by: John Dalberg | last post by:
I am getting a "Could not allocate space for object 'temp_trc' in database 'Test' because the 'PRIMARY' filegroup is full" The database test has unrestricted growth (All the defaults). It resides...
27
by: Aurangzeb M. Agha | last post by:
I'm running Postgres 7.1.3, and just started having a problem where my dynamic site is going down (read-only DB, with no writes happening to the DB) regularly (every other day). I have no idea...
0
by: hank | last post by:
Hi All How to monitor the temp space usage and determine which application is the highest usage of temp space? Thanks Hank
11
by: Eliot Coweye | last post by:
According to Einstein, objects of great mass affect timespace. Can a great mass of bits in a badly written C++ program affect timespace, making the harddisk were it is written on incredibly slow...
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
9
by: Ajay | last post by:
Hi all, Can I know what is the stack space and heap space allocated by the compiler.Can i increase it or decrease it.if yes,pleae tell me theway to do it.Thanks in advance. Cheers, Ajay
2
by: disco990 | last post by:
Hello everyone! I have an assignment in my Java class to gauge and compare the "order of growth" of two different sections of code. Below is the actual assignment: "The following code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.