in reply to Re: Looping through database query to send emails is taking too long
in thread Looping through database query to send emails is taking too long

10 seconds is far too long for a database lookup on 100 records.

Yes. Maybe missing indexes or missing primary key? htmanning, please show the select statement and the table definition(s) (create statements).

Another problem may be the mailserver. Internal mail servers are usually very generous, unlike public mail servers. On the latter ones, intentional delays are quite usual to defend against spam bots. The usual way around this problem is to talk with the mail server admin, (s)he will know which mailserver to use, and how to login there, if needed.

Adding some debug output with timestamps to the program should show very fast which part of the program is slow.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)