On Fri, Nov 21, 2003 at 06:08:49PM +0100, Magnus Sundberg wrote: > Christian G. Warden wrote: > > > > >A database can perform well at easier tasks too. In my experience, > >dbmail is already faster at updating a large folder than uw-imapd with > >mbox. Ilja's recent changes make copying messages very fast. If we > >index some of the headers, we can also get improved performance on > >server-side searching. > > > > Today, we deliver all the mail data to the messageblock table. > What about delivering the headers to a "header" table and the > rest of the message to the messageblock. > > Suppose we have something like > CREATE TABLE headerblks ( > headerblk_idnr bigint(21) NOT NULL auto_increment, > physmessage_id bigint(21) NOT NULL default '0', > headerblk longtext NOT NULL, > blocksize bigint(21) NOT NULL default '0', > PRIMARY KEY (headerblk_idnr), > KEY physmsg_index (physmessage_id), > FOREIGN KEY (`physmessage_id`) REFERENCES > `physmessage`(`id`) ON DELETE CASCADE, > ===> FULLTEXT (headerblk) > ) TYPE=InnoDB; > The above is a copy of the messageblks structure, with the string > "messageblk" changed to "headerblk" and a FULLTEXT index on the > headerblk. This way, we can search for all kind of headers with a > simple SQL statement, and actually not do that much of coding > ourself.
Headers are already stored in their own messageblk. Simply adding a header flag to messageblks would allow selecting multiple headers in a single select. We've talked about actually storing common headers, such as To, From, Subject, Date, etc. in their own fields. btw, fulltext indexes aren't supported in innodb tables yet :( xn