[dovecot] Re: index files

Timo Sirainen tss at iki.fi
Wed Apr 23 14:13:09 EEST 2003

On Wed, 2003-04-23 at 11:26, Farkas Levente wrote:
> ok the whole story:
> - once (one of the cvs version) we got a few corrupted index file.
> - then I delete all index file
> - after that (as I wrote it) the load goes so high I've to stop dovecot.
> - delete all index file and modify dovecot.conf :
>    mail_cache_fields =
> - but now I assume the index and high load problem may be solved so I'd
>    like to put back the default cache schema.

But currently there's no real high load problems with empty

> and my question is:
> should I delete the old index files (which contains no fileds) in
> order to create new index files (which contains the default fields) or
> it will happned automaticaly?
> from you first answer it seems to me if the index is not corrupted than 
> it never will recreated. but from the second it seems it will regenerate 
> it automatically?
> so?

It goes like this:

- When index is first created, mail_cache_fields setting is saved into
header.cache_fields. All existing mails are indexed with those fields
- If client does something where a cached field would have been a
speedup, but the field isn't cached, header.cache_fields is updated to
include that field
- All new mails that are indexed will have the new field cached as well,
but the old ones aren't changed
- If client again does it with an old mail where it wasn't indexed, then
Dovecot will rebuild the cache for all mails in the index so they all
contain the wanted cached fields

So even if you don't cache anything initially, they should get
automatically cached if client wants them. Clients behave very
differently so we don't automatically cache everything, if cached field
is not needed it just slows down things.

This still isn't the optimal caching behaviour, some clients cache
everything locally and fetch data for only new mails. In that case
cached fields would be mostly useless. Even if that client or some other
occationally fetches some data again, it's likely better for overall
performance if nothing is cached.

More information about the dovecot mailing list