Re: [Exim] Reducing mysql load

Top Page
Delete this message
Reply to this message
Author: David Leggett
Date:  
To: exim-users
Subject: Re: [Exim] Reducing mysql load
On Wednesday 29 October 2003 22:31, Avleen Vig wrote:
> On Wed, Oct 29, 2003 at 10:14:42PM +0000, David Leggett wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > I have my MTA (exim 4.24) set up here at home to take all its data from a
> > mysql database. After looking at my mysql log I realised that exim was
> > doing about 6-10 queries per incoming email.
> > Most of those queries seem to me to be work that isnt needed.
> > They are lookups to satisfy local_parts= and domains= for my routers,
> > having 3 different routers with exactly the same set of domains/local
> > parts and exactlly the same query (SELECT local_part from mail_users
> > WHERE local_part='$local_part' AND domain='$domain'; for local_part=)
> > I am wondering if there is any way to reduce the load that this is
> > putting on mysql, although I guess its not vital as I have very few users
> > (and I dont ever anticipate having many).
> > Just looking for a bit of extra efficiency *grin*.
>
> I dont' know about reducing the number of queries as I don't know how
> you have your DB's laid you, but have you indexes the appropriate
> columns in your db tables? That'll help a LOT.


Yeah both the fields i do a WHERE field='value' are indexes.
Here is the schema of the table in question if it helps:

#
# Table structure for table `mail_user`
#
CREATE TABLE `mail_user` (
`local_part` char(255) NOT NULL default '',
`domain` char(255) NOT NULL default '',
`user` char(128) NOT NULL default '',
`password_crypt` char(128) NOT NULL default '',
`password_md5` char(128) NOT NULL default '',
`name` char(128) NOT NULL default '',
`home` char(255) NOT NULL default '',
`maildir` char(255) NOT NULL default '',
`quota` char(255) NOT NULL default '',
`id` int(11) NOT NULL auto_increment,
PRIMARY KEY (`id`),
UNIQUE KEY `user` (`user`),
KEY `domain` (`domain`),
KEY `local_part` (`local_part`)
) TYPE=MyISAM;

- --
David Leggett
david@???
http://www.asguard.org.uk
http://www.site-control.org
Get my public GPG key from http://www.asguard.org.uk/~david/david.asc
Fingerprint: 432E 4EAD E1E5 26BB 29EB 47FA CBDE AB17 0D23 C76B