31 Mar
2007
31 Mar
'07
5:34 p.m.
I wasted some time yesterday and today implementing a SQL storage plugin. It seems to be working, but:
- Saving new messages is done in a regular INSERT statement, which is bad. PostgreSQL has at least this COPY TO command which could be used instead.
- It breaks in stress testing
- It's not that well optimized. Especially it could support caching some commonly requested fields (same as dovecot.index.cache file).
- Currently works only with PostgreSQL.
Nothing is committed to CVS yet. I'm not sure if I should even do that. I'm not sure if those lib-sql API changes were that great. Maybe there's a better way..
If you're interested in trying it, you need the latest CVS HEAD sources and these patches:
http://dovecot.org/patches/sql-storage-changes.diff http://dovecot.org/patches/sql-storage-plugin.diff
The SQL schema is in src/plugins/mail-sql/schema.sql file. It creates a "tss" named user by default, so you might want to modify that. :)
Then set:
mail_location = sql:pgsql:host=localhost dbname=mails user=mailuser password=foo mail_plugins = mail_sql