On Wed, 21 Dec 2005 08:44:23 +0100, Thomas Bruederli roundcube@gmail.com wrote:
Lic. Martin Marques wrote:
What does the messages table exactly store?
I'm looking at it's contents and it looks like it puts there good part
of the mail headers, plus some other information.
This table is used to store message headers locally for caching purpose.
It will only be used if caching is enabled which is not necessary if the
IMAP server runs on the same machine.
I'm not sure yet, how to keep this table clean to avoid an exhausting
amount of cached messages here. One possibility is to store the message
headers just for the current session and remove them when logging out.
But for performance issues it would be better to keep the cached
messages over multiple sessions...
Other thought was to add a last_view_date which could allow a garbage
collection routine to remove headers that haven't been listed over a
certain amount of time. The disadvantage of this behavior would be that
on every view (SELECT from DB) the last_view_date has to be updated what
will cause the database to rewrite it's index and make it slower again.
Definately not a caching expert, however i have worked with several DBs that did some basic caching. One thought would be to add a date_inserted (can be added via a trigger on insert in postgres, not sure that mysql supports those) and clean out after a pre-determined (user configurable) amount of time.
Updating on every SELECT pretty much defeats the point of having it in a DB, no? since you'd incur a write op for every read op?
I also liked the idea of only caching the first (n) pages of the mail, however, this doesn't work for sorting. In fact, any type of "expiry" of the cache would make re-sorting MUCH slower since we'd have to re-download the message list.