[DBMail] is an IMAP server that uses an SQL database backend to store the emails. It's possible to improve the IMAP server performance by optimizing the SQL server.
MySQL
Compile MySQL 5.0.x with LinuxThread if you are using FreeBSD 4.x or 5.x, since that will make it works faster.
Also check these links:
Known bugs
Server-side sorting is broken in DBMail 2.0.7. Don't use server-side sorting if you get the following error:
ERROR : Connection dropped by imap-server.
Query: SORT (FROM) ISO-8859-1 ALL