Now that I have 2.0 built, I was poking around a bit and noticed that
there are no transactions used. This will tend to hurt performance (at
least for postgresql) for inserts and that sort of thing since the
database can batch writes to the database during a transaction.
With a really basic addition of begin/commit around the calls
db_insert_message and db_insert_block in pipe.c, I saw an improvement
of about 30% in insert speed over the non-transactioned version. (run
over ~1000 messages, 6 min vs ~9 min. )
eric
Index: db.c
===================================================================
RCS file: /cvsroot-dbmail/dbmail/Attic/db.c,v
retrieving revision 1.1.2.23
diff -r1.1.2.23 db.c
526a527,548
> void db_begin_transaction() {
> snprintf(query, DEF_QUERYSIZE,
> "BEGIN TRANSACTION");
> if (db_query(query) == -1) {
> trace(TRACE_STOP, "%s,%s: query failed", __FILE__, __FUNCTION__);
> }
> }
> void db_commit_transaction() {
> snprintf(query, DEF_QUERYSIZE,
> "COMMIT TRANSACTION");
> if (db_query(query) == -1) {
> trace(TRACE_STOP, "%s,%s: query failed", __FILE__, __FUNCTION__);
> }
> }
> void db_rollback_transaction() {
> snprintf(query, DEF_QUERYSIZE,
> "ROLLBACK TRANSACTION");
> if (db_query(query) == -1) {
> trace(TRACE_STOP, "%s,%s: query failed", __FILE__, __FUNCTION__);
> }
> }
>
Index: db.h
===================================================================
RCS file: /cvsroot-dbmail/dbmail/db.h,v
retrieving revision 1.39.4.7
diff -r1.39.4.7 db.h
999a1000,1005
> /* transaction management */
> void db_begin_transaction();
> void db_commit_transaction();
> void db_rollback_transaction();
>
>
Index: pipe.c
===================================================================
RCS file: /cvsroot-dbmail/dbmail/pipe.c,v
retrieving revision 1.95.4.5
diff -r1.95.4.5 pipe.c
282a283
> db_begin_transaction();
324a326,328
>
>
>
336a341
> {
337a343,344
> /* db_rollback_transaction(); */
> }
509a517,520
>
> db_commit_transaction();
>
>