Postfix/Dovecot configuration with virtual users
I finally found the solution. Postfix is configured to look in the database that the user exists to deliver the email, so Dovecot shouldn't have to do it when receiving an email from Postfix to deliver.
That's how it is supposed to work, and the reason why we define a static userdb. It missed one parameter so that Dovecot wouldn't check if the user exists, because Postfix already does it:
/etc/dovecot/conf.d/auth-sql.conf.ext
(only useful part):
userdb {
driver = static
args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n allow_all_users=yes
}
Adding allow_all_users=yes
parameter solved the issue.