A
ags5406
I've created an application that downloads data daily from a secure
web site and stores that data in an Access database. Then there are
different options for allowing the user to do keyword and date
searches on the database and have the information displayed for them.
Everything looks and functions great, my only real dissatisfaction
with my application is the update time, which in my last test took
about 45-46 minutes for 9800 records.
When the update occurs, generally three steps are performed. The data
is downloaded as a single XML string, the XML string is parsed, and
then the new records are added to the database. I add all of the
records to a temporary table (one by one) from VB.NET using INSERT
INTO and then have a couple of queries that merge the temporary table
data into the final table.
I've have determined that the download is taking roughly 8% of the
process time, the parsing is taking about 4%, and the communication
with the database is taking 88% (45-46 minutes) of the time.
This 45 minutes almost exclusively consist of INSERT INTO statements
adding records one at a time in the following way...
...string sSQL (INSERT INTO blah blah blah) is constructed
right before this...
myCnxn = New OleDbConnection(sDBCnxnString)
cmUsrSQL = New OleDbCommand(sSQL, myCnxn)
myCnxn.Open()
iDummy = cmUsrSQL.ExecuteNonQuery
myCnxn.Close()
...the next sSQL is constructed and the process is repeated...
Is there a way to add records in mass? If I'm using INSERT INTO, can
I add more than one record with a single SQL statement?
Just now as I type this I'm wondering how much time I'm wasting
opening and closing and opening and closing...
Any links to any articles on this topic would be greatly appreciated.
Thx.
web site and stores that data in an Access database. Then there are
different options for allowing the user to do keyword and date
searches on the database and have the information displayed for them.
Everything looks and functions great, my only real dissatisfaction
with my application is the update time, which in my last test took
about 45-46 minutes for 9800 records.
When the update occurs, generally three steps are performed. The data
is downloaded as a single XML string, the XML string is parsed, and
then the new records are added to the database. I add all of the
records to a temporary table (one by one) from VB.NET using INSERT
INTO and then have a couple of queries that merge the temporary table
data into the final table.
I've have determined that the download is taking roughly 8% of the
process time, the parsing is taking about 4%, and the communication
with the database is taking 88% (45-46 minutes) of the time.
This 45 minutes almost exclusively consist of INSERT INTO statements
adding records one at a time in the following way...
...string sSQL (INSERT INTO blah blah blah) is constructed
right before this...
myCnxn = New OleDbConnection(sDBCnxnString)
cmUsrSQL = New OleDbCommand(sSQL, myCnxn)
myCnxn.Open()
iDummy = cmUsrSQL.ExecuteNonQuery
myCnxn.Close()
...the next sSQL is constructed and the process is repeated...
Is there a way to add records in mass? If I'm using INSERT INTO, can
I add more than one record with a single SQL statement?
Just now as I type this I'm wondering how much time I'm wasting
opening and closing and opening and closing...
Any links to any articles on this topic would be greatly appreciated.
Thx.