[Dovecot] domain quota in sql

Adam Szpakowski as at 3a.pl
Wed Feb 15 10:37:02 EET 2012

On 15.02.2012 09:19, Robert Schetterer wrote:
> as workaround it should be possible to calculate filllevel
> by domain with some bash script and cron sending  an info mail to you
> might be not exact, but enough to see whats going on ( depends on your
> real domain/mailbox setup...maildir etc)
I'm affraid that this is not a viable option. It should be done quite 
often to achieve "live data" feel and the amount of I/O to do so on 
storage/filesystem level is staggering.

Good enough solution will be to have an additional column in db table 
with domain for each quota record. This will allow us to do something 
like this:

SELECT domain, sum(bytes) as sum_bytes, sum(messages) as sum_messages 
FROM used_quota GROUP BY domain

The missing domain info can be updated regularly via some cron script. 
This could be a workable solution.

Adam Szpakowski

More information about the dovecot mailing list