After some investigation, I found that they were constructing full SQLs, instead of using parameters. Below is a piece of their code:
Dim con As ODBCConnection Dim qry As ODBCQuery Dim result As ODBCResultSet Set qry = New ODBCQuery Set result = New ODBCResultSet con.ConnectTo("The high-lite is the trouble. Whenever this was called, I noticed so many queries on Oracle data dictionary views. It seems to me that Notes was parsing the SQL, and the second statement sometimes took about 2 seconds.") Set qry.Connection = con for each document loop qry.SQL = "insert into person (fname,lname) values( '" & v_fname & "','" & v_lname & "' )" Set result.Query = qry end loop ...
To solve it, I did some research and found the parameters was useful.
qry.SQL = "insert into person (fname,lname) values( ?fname?, ?lname? )" Set result.Query = qry for each document loop Call result.SetParameter( fname, "'" & v_fname & "'" ) Call result.SetParameter( lname, "'" & v_lname & "'" ) end loop
The performance improved greatly, one example is 30K records reduced time from 4 hours to 10 minutes. Still high, but Notes spends most of the time preparing data.
No comments:
Post a Comment