A BUGNOTE has been added to this bug. ====================================================================== http://dbmail.org/mantis/bug_view_advanced_page.php?bug_id=0000125 ====================================================================== Reported By: aaron Assigned To: aaron ====================================================================== Project: DBMail Bug ID: 125 Category: Database layer Reproducibility: always Severity: feature Priority: normal Status: assigned ====================================================================== Date Submitted: 27-Nov-04 12:53 CET Last Modified: 22-Dec-04 17:07 CET ====================================================================== Summary: ACL lookups are terribly inefficient Description: ACL lookups are done with one query per acl type. That means at least a dozen queries for each and every time you read a message or open a mailbox for a summary.
Rewriting the queries and some of the db_acl_* functions to select entire rows of acl's in one query would be much preferred. The temptation is then to cache the ACL values in a bitfield structure. Perhaps not so a bad an idea! ====================================================================== ---------------------------------------------------------------------- ilja - 29-Nov-04 10:45 CET ---------------------------------------------------------------------- FYI: When I first programmed the ACL code, I conciously made the decision to not make this extremely efficient. I wanted to have (somewhat) clean, working code first, and optimize later. There are a few ways in which this can be optimized. Getting all privileges for a user on a mailbox at once, and storing them in a bitfield seems like a very reasonable approach. I'm not completely sure on where to store this bitfield though. It could be a static variable in db_acl_has_right() for instance, but maybe we should try to avoid using statics.. ---------------------------------------------------------------------- aaron - 22-Dec-04 17:07 CET ---------------------------------------------------------------------- Added a listing of the functions which calls acl_has_right. When called three or four times in succession, a SELECT is done each time for a different column of the same row of the same table. Bug History Date Modified Username Field Change ====================================================================== 27-Nov-04 12:53aaron New Bug 29-Nov-04 10:45ilja Bugnote Added: 0000381 22-Dec-04 17:06aaron File Added: imapacl.c 22-Dec-04 17:06aaron File Added: imapacls.c 22-Dec-04 17:06aaron File Deleted: imapacl.c 22-Dec-04 17:07aaron Bugnote Added: 0000461 ======================================================================