views:

94

answers:

3

This is related to my previous thread: http://stackoverflow.com/questions/3069806/sql-query-takes-about-10-20-minutes

However, I kinda figured out the problem. The problem (as described in the previous thread) is not the insert (while its still slow), the problem is looping through the data itself Consider the following code:

 Dim rs As DAO.Recordset
Dim sngStart As Single, sngEnd As Single
Dim sngElapsed As Single



Set rs = CurrentDb().QueryDefs("select-all").OpenRecordset
MsgBox "All records retreived"

sngStart = Timer
Do While Not rs.EOF
    rs.MoveNext
Loop
sngEnd = Timer
sngElapsed = Format(sngEnd - sngStart, "Fixed") ' Elapsed time.

MsgBox ("The query took " & sngElapsed _
    & " seconds to run.")

As you can see, this loop does NOTHING. You'd expect it to finish in seconds, however it takes about 857 seconds to run (or 15 minutes). I dont know why it is so slow. Maybe the lotusnotes sql driver?

any other ideas? (java based solution, any other solution)

What my goal is: To get all the data from remote server and insert into local access table

A: 

My recommendation is that you create a Pass-Through query that will get the data from the remote server. Then create a Make Table query that uses the aforementioned query as its source. Your function then would be simplified to a call to this second query.

websch01ar
I already have the passthrough query (to get the data from the remote server). I will research the make table query.
masfenix
If you change to SQL view on a new query, just do a Select * INTO newtable from passthroughquery
websch01ar
Takes about 15 minutes :(
masfenix
I am glad you were directed to the NotesSQL document. The problem had to be external to Access.
websch01ar
A: 

The loop isn't doing "nothing" it's calling MoveNext, which is potentially doing A LOT.

David Hill
Right, so I need it to stop doing a lot, and just transfer the damn data to my local access table. :P
masfenix
A: 

This document has some information about performance tuning in NotesSQL. If you aren't already, select your data from Notes Views instead of Notes Forms. NotesSQL will then leverage the indexes within the views for faster queries. You may need to create the view in the Notes database, but the performance benefit will make it worthwhile.

Ken Pespisa