C
Chutney via AccessMonster.com
I am looking for a more efficient (read faster) way to append new records to
and update existing records in a master table.
My master table, tblMaster, is primary keyed on ref_no. I download data from
the mainframe to a staging table, tblStaging, that has no indexes. The
downloaded data consists of two type of records: new records that do not
exist in tblMaster (i.e. their ref_no is not in tblMaster) and old records
that exist in tblMaster but have new data.
My requirement, and procedure, is quite simple.
1. I run an update query that relates the two tables on ref_no and replaces
the data in all fields WHERE ref_no is equal. (Most records are in this
category.)
2. I run an append query that attempts to append all records from tblStaging
to tblMaster. The primary key allows only the new records to be appended.
(There are only a few records in this category.)
The update query is slow but acceptable. The append query is unbelievably
slow and not acceptable. A "Find Unmatched Query" created by the Wizard runs
reasonably fast to create a list of the records to be appended. However, when
I apply the same join logic (WHERE tblMaster.ref_no Is Null) to the append
query it does not seem to run any faster.
Can anyone suggest a more efficient way(s) to achieve the update and append?
a. Can I somehow combine the two queries?
b. Can the first query strip out the updated records so the second query
deals only with the remaining new queries?
c. Would indexing tblStaging on ref_no help. I don't see how but I am willing
to try if there is a logical reason. (I have not done so because it will slow
down the import procedure thereby, perhaps, negating any increase in append
speed.)
Thanks and regards.
and update existing records in a master table.
My master table, tblMaster, is primary keyed on ref_no. I download data from
the mainframe to a staging table, tblStaging, that has no indexes. The
downloaded data consists of two type of records: new records that do not
exist in tblMaster (i.e. their ref_no is not in tblMaster) and old records
that exist in tblMaster but have new data.
My requirement, and procedure, is quite simple.
1. I run an update query that relates the two tables on ref_no and replaces
the data in all fields WHERE ref_no is equal. (Most records are in this
category.)
2. I run an append query that attempts to append all records from tblStaging
to tblMaster. The primary key allows only the new records to be appended.
(There are only a few records in this category.)
The update query is slow but acceptable. The append query is unbelievably
slow and not acceptable. A "Find Unmatched Query" created by the Wizard runs
reasonably fast to create a list of the records to be appended. However, when
I apply the same join logic (WHERE tblMaster.ref_no Is Null) to the append
query it does not seem to run any faster.
Can anyone suggest a more efficient way(s) to achieve the update and append?
a. Can I somehow combine the two queries?
b. Can the first query strip out the updated records so the second query
deals only with the remaining new queries?
c. Would indexing tblStaging on ref_no help. I don't see how but I am willing
to try if there is a logical reason. (I have not done so because it will slow
down the import procedure thereby, perhaps, negating any increase in append
speed.)
Thanks and regards.