Author: Artis Caune Date: To: Sam Smith, exim-users Subject: Re: [exim] Trim down pgsql callouts
On Fri, Jul 18, 2008 at 9:58 AM, Phil Pennock <exim-users@???> wrote: > So, the DB will be checked once per message in the queue, once per
> queue-run.
>
> If you have a one-recipient limit, then you can get around this by using
> an $acl_m_foo variable which is stored in the spool file. For the
> general case, I'm not seeing a way to reduce this.
90% of incoming MX messages are with one recipient. (for us)
There is one way to reduce this to one lookup per message (1 recipient):
At acl (verify) time, lookup recipient data:
set acl_m_address_data = key="$local_partAT$domain" ${lookup
pgsql{GET_RECIPIENT_DATA}}
Check if lookup is okay
Use $acl_m_address_data in verify conditions and extract components.
At routing time, firs check if ${extract {key}{$acl_m_address_data}}
match "$local_partAT$domain"
If this message has one recipient, they will match
If match, set
address_data = $acl_m_address_data
else
address_data = ${lookup pgsql{GET_RECIPIENT_DATA}}
I also check if this is "fisrt_delivery", so second and other
deliveries will not use $acl_m_ variable, because it could be out of
data (for us).
So if message has one recipient, and it could be delivered at first
time (90% :) ), then I only do one lookup for message.
If you need one lookup for more than one recipient, you can play with:
add_headers = X-exim-$local_partAT$domain: ${lookup pgsql{GET_RECIPIENT_DATA}}
and later headers_remove ..., but it's not worth it.