Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3232720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:11:37+00:00 2026-05-17T17:11:37+00:00

I’ve got a PHP script that sends newsletters to a bunch of email adresses,

  • 0

I’ve got a PHP script that sends newsletters to a bunch of email adresses, it sends 15000 newsletters an hour, until all email adresses have been processed.

Because this process isn’t run in one time, I have a table where I register all the adresses which have been mailed, so I can always easily get the unmailed adresses.

Here is a simplified example of what I do:

 select a.* 
 from email_all a left outer join email_send s 
      on s.email_id = a.id 
      and s.mailing_id = 1 
 where s.id IS null 
 limit 0, 15000

So all the adresses who haven’t been mailed yet are selected, now the problem is, the more newsletters have been sent, the more adresses that are logged in the ’email_send’ table and the slower the query gets. In the beginning there are 50.000 adresses in the table ’email_all’, and in ’email_send’ there are none, after a few ours there still are 50.000 adresses in table ’email_all’, and also 50.000 adresses in ’email_send’, and then all hell breaks lose. The scripts works perfectly for smaller mailings, like 10.000.

I’ve placed an index on the column ’email_id’ in the second table, primary keys have been set.

Is there anyway I can speed it up? I’ve used ‘NOT EXISTS IN’ too but that doesn’t help 🙁

Anyone can help?

Thx!!

Steve

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:11:38+00:00Added an answer on May 17, 2026 at 5:11 pm

    Don’t log email addresses that have been sent in other table. Just make another field in email_all table, tinyint(1) sent, and just update that field when email for that user is sent. Or make one large queue table and delete rows from there when they are sent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from
I'm trying to create an if statement in PHP that prevents a single post
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.