|
Question : Append to Oracle too slow
|
|
I am using an Access database front end to an Oracle back end. I create a temporary table for data within MS Access and then want to append that data to the Oracle table. The code I am currently using works, but take 6 minutes to append only 800 records! If anyone has any ideas on speeding this up, I'd sure be interested. I'm also analyzing and computing statistics on the Oracle side just about every time I do something just to try and help the speed.
I have set up two test tables to get this functioning before I go with live data. The table in Oracle is called JSHL_WO_LD_TEST. The table in Access is called jsht_LONG_DESCRIPTION. I'm not a programmer so please forgive my naming conventions. I'm using the following code to append from Access to Oracle:
=================== Sub append_ld_to_oracle()
DoCmd.SetWarnings False
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("jsht_LONG_DESCRIPTION")
rs.MoveFirst
While Not rs.EOF CurrentDb.Execute "INSERT INTO JSHL_WO_LD_TEST _ (WONUM, LDKEY, LDTEXT, REPORTDATE) VALUES _ ('" & Replace(rs(0), "'", "''") & "', '" & Replace(rs(1), "'", "''") _ & "', '" & Replace(rs(2), "'", "''") & "', '" & Replace(rs(3), "'", "''") & "');" rs.MoveNext Wend
DoCmd.SetWarnings True
End Sub ===================
|
|
Answer : Append to Oracle too slow
|
|
I apologize for the delay in getting to this question. These hurricanes are being rather inconsiderate in not checking my schedule....I'll have to talk to their manager...
In any case, I gather from your posts here that you solved the last ADO problem you were having from the previous question?
Triggers are a form of automation. An easy example would be for a library check-out system. If someone has a late book, their account is marked with a block until they pay the fine. To automate removing the block, you could put a trigger on the Payments table to check the sum of fines still due. This way, every time a payment is made, the trigger would run, check to see if all fines have been paid, and, if necessary, automatically update the table to reflect removal of the block. rockmuncher's post regarding triggers is a valid point. If you have any triggers operating on the Oracle side of your connection, they will likely slow down the INSERT considerably.
Another suggestion handled in our previous question involves looping through the recordset. Going through a local recordset and conducting the INSERT record-by-record will always take longer than doing it all at once through SQL. The best performance you can expect is if you link the Oracle table in Access, and do the INSERT on the Access side through that linked table. I have to agree with rockmuncher again, though...you will likely not see any significant boost in performance. At this point, I believe your execution time is a result of the communication overhead between Access and Oracle.
Importing a text could be another way around this issue for you. You can set up a routine to export the data to a file, copy the file to the Oracle server, then import it locally on Oracle. With 800+ records, including a memo field, you could potentially see MUCH better performance using this route. Not being familiar with Oracle, I would recommend you start a question for this item in the Oracle TA with a pointer here for the back story.
|
|
|
|