The mailbox_messages table

mailbox_messages links mailboxes and messages together. The flags and annotations tables are also tied to it since flags and annotations aren't shared when a message occurs in more than one mailbox.

This is perhaps the most central table in the entire database. For every message which is visible in a mailbox, there is a row in this table. (Some messages aren't visible, usually because they've just been deleted and not yet cleaned up. Others are visible in more than one mailbox, and so have more than one mailbox_messages rows.)

mailbox and message tie this row to the mailboxes and messages tables.

The uid column is the message's number in this mailbox. Whenever a message is added to a mailbox, it receives a number larger than all other messages in the mailbox. (This is initialised from mailboxes.uidnext.)

The idate is the time the message was added to the mailbox. Archiveopteryx sets it correctly when a message is added via SMTP or LMTP, but IMAP clients can also add messages, and specify any idate they want.

The modseq is a change counter. Whenever a message's flags or annotations change, Archiveopteryx increases modseq. Smart IMAP clients can use this with CONDSTORE to save bandwidth.

create table mailbox_messages ( mailbox integer not null references mailboxes(id), uid integer not null, message integer not null references messages(id), idate integer not null, modseq bigint not null, primary key (mailbox, uid) );

The mailbox_messages table was introduced in version 2.06.

In case of questions, please write to info@oryx.com.

Relevant links

About this page

Last modified: 2008-08-20
Location: aox.org/db/mailbox_messages