The following table shows the relative performance of the different query methods. To make the comparison more concrete, as a test, each of these methods performed 100 insertions into a Microsoft Access 2.0 table that had five fields of text data. Note that these are not exhaustive benchmarking results. They are provided to illustrate the relative merits of these methods. The methods are listed in order of increasing performance.
Method | Time |
100 SQLExecDirect insertions in auto-commit mode | 5457 ms |
100 SQLExecDirect insertions in a single transaction | 4756 ms |
100 insertions performed by calling SQLPrepare/SQLExecute in auto-commit mode | 3515 ms |
100 insertions performed by calling SQLPrepare/SQLExecute in a single transaction | 2994 ms |
100 SQLSetPos/SQL_ADD insertions in auto-commit mode | 831 ms |
100 SQLSetPos/SQL_ADD insertions in a single transaction | 721 ms |
Adding data by calling SQLSetPos in a transaction results in 139 insertions per second. Calling SQLExecDirect in auto-commit mode to execute an INSERT SQL statement results in 18 insertions per second. Although the results specifically apply to insertions, the concepts apply equally well to deletions and updates.