Currently folder indexing uses Mork, and message index is per folder. Mork removal has been wanted for a long time (bug 453975), but when working on removing it from usage for the folder index we should also take the opportunity to design it correctly to use a global message index.
This would enable a conversation view of messages (which currently requires gloda, and gloda is not meant for that).
It would make issues like bug 43278 go away.
I belive for Gmail, we're downloading the same messages multiple times, because we don't know it's already in All Mail (duh!).
We need to figure out how storage of the actual message data should be handled: put it in the database, or keep it on the file system, or a combination where normalized/decoded content would be put into the database for quick searching and indexing and the raw data would be kept only for backup.
Primarily I think we should target IndexedDB for database, since that is the web thing to do.