Autor: Graeme Fowler Data: A: exim-users@exim.org Assumpte: Re: [exim] DB lookup caching and multiple columns/fields
On Tue, 2012-11-27 at 09:56 -0500, Robert Blayzor wrote: > Does caching not work if you use the SQL in a macro?
It might - it depends. Have a look at the docs, Chap 9, section 8.
The short way to look at this is that a lookup might be cached within an
SMTP connection if, and only if, you can do a single lookup early enough
to guarantee grabbing all the data you need.
As an example, when running a valid address through "exim -bt" here at
work I see a single MySQL lookup on the domain part which is
subsequently re-used from the cache 4 additional times; but I also see
two subsequent lookups which are based on data from the first which are
not cached.
For performance reasons you need to work out whether having a complex
SQL query (with potential joins, and so on) is faster at returning all
the data you want as compared to multiple, smaller lookups on indexed or
optimised tables. There is no "right answer" to that, you can only
figure that one out by instrumenting your system to see what it's doing.