Archiving

K

krcmd1

I have developed over the years a database which now is bloated by inactive
records on a 10-20 linked tables.

Where can I find suggestions about code to extract, move and delete
(archive) records from linked tables?

Thank you!

Ken
 
T

Tony Toews [MVP]

krcmd1 said:
I have developed over the years a database which now is bloated by inactive
records on a 10-20 linked tables.

Where can I find suggestions about code to extract, move and delete
(archive) records from linked tables?

Unless your MDB file is approaching 2 Gb don't bother. Your
performance should still be fine. if it isn't then you're likely
missing some indexes on filtering criteria such as dates.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
A

Allen Browne

You have 20 million records in some tables?

If so, you will want to:
a) Create a new (blank) database to use as the arvhive.
Same tables (structure only.)

b) Figure out a cut-off date for archiving.

c) Make decisions about how to duplicate data between the current db and the
archive. (For example, if the cutoff is 5 years ago, any customer who has
newer and older records will be in both, but anyone who has no orders in the
last 5 years will not be in the current database?)

d) Examine the relationships between tables, and design a strategy that
takes the dependencies into account. For example, order details must be
handled before orders, and orders before customers (since you cannot delete
the old orders until the order details are gone, and you cannot delete the
customers until their orders are gone.) Be especially aware of any cascading
deletes: archive in the wrong order here, and you lose data. (JET is not
always good at preventing dependencies in cascades.)

e) Figure out the amount of data being executed. It would be nice to do the
whole archive in a transaction, but it may be too large to process (or too
inefficient.) It might be better to make a backup of the data file instead,
so you have a physical rollback point rather than a JET transaction.

f) Write the queries. If this is something you will do periodically, you can
do this as a VBA routine: a form that makes a copy of the structure-only
database (from (a) above), executes each of the Append queries to add the
archive data, and then executes each of the delete queries to remove the old
data from the current database.

g) Compact the current database, to regain the space.

In the end you have 3 databases:
- the archive, with only the old records;
- the current database, with current records (perhaps overlapping some
archived ones);
- the backup (with both), in case anything went wrong.
 
T

Tony Toews [MVP]

krcmd1 said:
Thank you! only 20 M so far. A ways to go, I guess!

Oh yes. I have some clients running 300 Mb MDBs with only slight slow
down in performance.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
A

aaron.kempf

Ten years ago, I used to work in an environment with ~~40 tables with
1m records each. In Jet.

It doesn't work reliably enough--
Upsize to SQL Server, utilize partitioning and 'partitioned views' and
you'll get great performance

-aaron
 
A

aaron.kempf

and for the record-- _FREE_ SQL Server has a 4gb limit, not a 2gb
limit.. and some versions of Access have a 1gb limit (per object) so
it's a big difference

also, with SQL Server, your databases automagically link together--
you don't need to run around like a chicken with your head cut off,
writing DAO and connection strings-- because it 'just works'

-Aaron
 
G

Grimwadec

I have a copy of MVP Allen Browne's detailed instructions re archiving. I
haven't tried it yet but I think I will have to make sure the archive tables
don't have Auto Number fields (several of them I use are e.g. the relating
Customers ID) to ensure the linkage with the "many" related records is
retained. Same problem if and when restoring as new Auto numbers would be
created?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top