QSqlQuery vs. SOCI: inserting 1000 times

Recently I'm using QtWebApp to develop an application, and I did some performance benchmark to select a database library in the backend.  I selected QSqlQuery and SOCI as candidates, and tried to insert 10,000 rows at once. The result is as follows:

  • Repeating single query
    • QSqlQuery: 10000ms
    • SOCI: 2500ms
  • Prepared statement
    •  QSqlQuery: 7000ms
    • SOCI: 750ms(?!)
In any situation, SOCI takes far less time than QSqlQuery. QSqlQuery seems to be really a bad choice for server applications. I suspect the bottleneck is the loooooong processing time for QString.

No comments:

Post a Comment

PostgreSQL vs. SQLite: read & write in multithreaded environment

The start was humble. I needed to cache some data, and I thought just push them to database table and give index, and the rest will be datab...

Popular in Code{nested}