The following issue has been SUBMITTED. ====================================================================== http://www.dbmail.org/mantis/view.php?id=373 ====================================================================== Reported By: benjamin9999 Assigned To: ====================================================================== Project: DBMail Issue ID: 373 Category: Database layer Reproducibility: always Severity: tweak Priority: normal Status: new target: ====================================================================== Date Submitted: 27-Jun-06 22:05 CEST Last Modified: 27-Jun-06 22:05 CEST ====================================================================== Summary: really slow header retrieval on pgsql, 100x speedup Description: now my users are filled with joy, and yours will be also.
db.c in 2.0.9, line 3967... the same statement is in the latest SVN for 2.0 tree sorry for no diff, but it's a one-liner anyway. snprintf(query, DEF_QUERYSIZE, "SELECT messageblk " "FROM dbmail_messageblks blk, dbmail_messages msg " "WHERE blk.physmessage_id = msg.physmessage_id " "AND msg.message_idnr = '%llu' " "ORDER BY blk.messageblk_idnr ASC LIMIT 1", msg_idnr); /*MR added LIMIT 1 - we are only getting the header, and therefore only use one row anyway */ if we just want the header, why aren't we using the "is_header" flag which has a better index ??? snprintf(query, DEF_QUERYSIZE, "SELECT messageblk " "FROM dbmail_messageblks blk, dbmail_messages msg " "WHERE blk.physmessage_id = msg.physmessage_id " "AND msg.message_idnr = '%llu' " "AND blk.is_header = 1 ", msg_idnr ); mailbox-list operations (read, squirrelmail) up to 100x faster on my system. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 27-Jun-06 22:05 benjamin9999 New Issue ======================================================================