Please sign in to comment.
Drop mail_status in favor of a partial index on the unarchived mail.
Initially the reason for mail_status is the simplicity and cross-dbms portability. But a partial index performs better that joining against plus maintaining mail_status, and porting to a different dbms is not a current goal. Installations that want to keep relying on mail_status for the compatiblity of their queries can have it as a view: CREATE VIEW mail_status AS select mail_id,status from mail where status&(256+32+16)=0; The partial index is on status&32=0 only, to simplify the logic. Messages that are trashed (16) or sent (256) tend to be archived, so it's okay, performance-wise, not to bother about trashed but not archived, or sent but not archived. As a consequence of dropping mail_status, the triggers on insert, update, delete on mail are dropped as well. Also create status_mask() to help with status bitmasks readability in code. Note: this commit does not touch manitou-mdx, but a previous commit fdf22c3 already carried the change (removing a join with mail_status) that should have landed in this commit.
- Loading branch information...