mail_status

A table automatically managed by triggers, that contains references to mail messages which are not yet archived (incoming), or not yet sent (outgoing). This table is supposed to be always relatively small and cached by the database server, so this allows to speed up queries that deal with the small subset of messages that is actually current. That is especially true for databases containing very large sets of messages.

> Columns

> Size

The number of rows should be the number of messages for which a processing is to be expected. It is supposed to be small compared to the total number of messages in the database. Also, the growth of the table should be null in the long run, because each time a message is archived, its corresponding entry in mail_status gets deleted.

> Notes

This table exists only for performance reasons and it's use is not encouraged except in the core of Manitou's application code. If possible, use the status field of the mail table instead.

If parts or all of the contents of mail_status get accidentally deleted, they can be regenerated using the following SQL query:

INSERT INTO mail_status(mail_id,status)
 SELECT mail_id,status FROM mail
  WHERE status&32=0 AND status&256=0 
    AND mail_id NOT IN (SELECT mail_id FROM mail_status)