Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 5th July 2006, 03:19
snowfly snowfly is offline
Member
 
Join Date: Jul 2006
Posts: 90
Thanks: 0
Thanked 4 Times in 3 Posts
Default Multiple MySQL Queries - with Postfix-mysql, courier-authmysql, maildrop-mysql...

Hi,

Ok I've been successfully running an email server for the past 2 years using the following:

- Debian Sarge
- 2.4.27 smp kernel
- courier-pop, courier-imap, courier-authmysql
- postfix-mysql, postfix-tls
- maildrop, maildropmysql
- spamassassin
- clamav
- amavisd

Basically it handles multiple domains, for virtual users, virus/spam protection, etc.

Now I've just been doing some cleaning up everything, and trying to get it run more efficiently, as I'm going to be setting up a new server soon.

I was looking at the mysql.log (/var/mysql/mysql.log), that I had turned on, and interesting was seeing multiple queiries for every email that the server received.

Here's an example, I was sending an email from an external address, to an address on the server:

Code:
060705 13:11:10     111 Query       select remote_address from email_aliases where email = 'xxxxx.co.nz'
                    112 Query       select maildir from email_addresses where email = 'xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = 'xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = 'co.nz'
                    113 Query       select transport from email_domains where domain = 'nz'
                    113 Query       select transport from email_domains where domain = 'xx@xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = 'xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = '.co.nz'
                    113 Query       select transport from email_domains where domain = '.nz'
                    114 Query       select remote_address from email_aliases where email = 'xx@xxxxx.co.nz'
                    114 Query       select remote_address from email_aliases where email = '@xxxxx.co.nz'
                    115 Query       select remote_address from email_aliases where email = 'xx@xxxxx.co.nz'
                    115 Query       select remote_address from email_aliases where email = '@xxxxx.co.nz'
And another list of queries 1 second later:
Code:
060705 13:11:11     111 Query       select remote_address from email_aliases where email = 'xxxxx.co.nz'
                    112 Query       select maildir from email_addresses where email = 'xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = 'xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = 'co.nz'
                    113 Query       select transport from email_domains where domain = 'nz'
                    113 Query       select transport from email_domains where domain = 'xx@xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = 'xxxxx.co.nz'
                    113 Query       select transport from email_domains where domain = '.co.nz'
                    113 Query       select transport from email_domains where domain = '.nz'
                    118 Query       select remote_address from email_aliases where email = 'xx@xxxxxx.co.nz'
                    118 Query       select remote_address from email_aliases where email = '@xxxxx.co.nz'
                    115 Query       select remote_address from email_aliases where email = 'xx@xxxxxx.co.nz'
                    115 Query       select remote_address from email_aliases where email = '@xxxxxx.co.nz'
                    123 Connect     maildrop@localhost on
                    123 Init DB     xxxxx
                    123 Query       SELECT email, uidnumber, gidnumber, maildir, maildir, quota FROM email_addresses WHERE email = "m
xx@xxxxx.co.nz" ""
                    123 Quit
Now why would there be soo many queries, firstly checking the sender email address against the transport table, and then checking each part of the email (before the @, after the @, and the tld's).

I don't think its maildrop, as there is only 1 mysql query from maildrop, the last one.

So I'm assuming its something to do with postfix, as before those logs above its connecting as postfix: "Connect postfix@localhost on xxxxx".

So has anyone seen this before? Multiple queries for just one incoming email?
Meaning the mysql server is doing far more than it should have to.

Courier-mysql seems to be ok, as I only get 1 query in the log when I check my email.

Thanks, any help, advice, or comments would be greatly appreciated.

Mike.

Last edited by snowfly; 24th October 2008 at 12:57.
Reply With Quote
Sponsored Links
  #2  
Old 6th July 2006, 10:06
osanet osanet is offline
Junior Member
 
Join Date: May 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

I used too debian sarge and I have postfix+mysql+spamassassin,amavisd-new,clamav...

I try running maildrop + mysql but it's not working
How you compiled maildrop with mysql, from source?

Can you write your configurations about maildropmysql and mai.cf,master.cf?

Regards,
osanet
Reply With Quote
  #3  
Old 6th July 2006, 11:42
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
Default

Quote:
Originally Posted by osanet
Hi

I used too debian sarge and I have postfix+mysql+spamassassin,amavisd-new,clamav...

I try running maildrop + mysql but it's not working
How you compiled maildrop with mysql, from source?

Can you write your configurations about maildropmysql and mai.cf,master.cf?

Regards,
osanet
Can you open a new thread for this?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #4  
Old 6th July 2006, 11:41
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
Default

Quote:
Originally Posted by snowfly
So has anyone seen this before? Multiple queries for just one incoming email?
Meaning the mysql server is doing far more than it should have to.
I think it's normal. Postfix has to do a lot of lookups to decide where to deliver the mail. As long as you don't see any errors in your mail log I wouldn't worry about it.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 7th July 2006, 04:19
snowfly snowfly is offline
Member
 
Join Date: Jul 2006
Posts: 90
Thanks: 0
Thanked 4 Times in 3 Posts
Default

Quote:
Originally Posted by falko
I think it's normal. Postfix has to do a lot of lookups to decide where to deliver the mail. As long as you don't see any errors in your mail log I wouldn't worry about it.
Thanks. Well there are no errors, so guess I won't worry about it for now.
Maybe if I get time I can look into it futher, as it would be nice to get postfix to cut down on mysql queries. Its doing on average 100 per minute with all the email its handling.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota... killfrog HOWTO-Related Questions 3 25th September 2009 21:45
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs mholownych HOWTO-Related Questions 10 29th May 2006 03:39
Autoreply problem using Virtual Users And Domains With Postfix, Courier And MySQL triak HOWTO-Related Questions 1 19th May 2006 15:25
Virtual Users And Domains With Postfix, Courier And MySQL - "apt-get" and Courier burritonator HOWTO-Related Questions 3 15th March 2006 20:11
Problem with Virtual Users And Domains With Postfix, Courier And MySQL Howto fenix Server Operation 4 11th March 2006 02:53


All times are GMT +2. The time now is 05:56.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.