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 8390697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:04:10+00:00 2026-06-09T19:04:10+00:00

In the `synchro_newitems` table I have all new items (from external source) ~ about

  • 0

In the

`synchro_newitems`

table I have all new items (from external source) ~ about 500k rows. It has one column:

`new_ids`

In the

`synchro_olditems`

table I have all current items (also from external source) ~ about 500k rows. It has one column:

`old_ids`

I must get only the new items from synchro_newitems:

(NEW ITEMS) = synchro_newitems (-) synchro_olditems

I tried do that by insert the differences to the 3rd table:

INSERT INTO `synchro_diff` (`id`) 
SELECT DISTINCT new_ids FROM synchro_newitems 
LEFT JOIN 
synchro_olditems ON synchro_newitems.new_ids = synchro_olditems.old_ids 
WHERE synchro_olditems.old_ids IS NULL

(similarly with “NOT IN”)

It’s works for small amount of rows. But fails when there are 500 000 rows to compare.

I’ve tried simple:

DELETE FROM synchro_newitems WHERE exists(SELECT * FROM synchro_olditems)

But it dosent work.. Do you know some smart method to do that?

  • 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-06-09T19:04:12+00:00Added an answer on June 9, 2026 at 7:04 pm

    This is a weirdness of mysql queries. Try this:

    select distinct new_ids
    from synchro_newitems n
    where not exists (select 1 from synchro_olditems o where n.new_ids = old.old_ids)
    

    This optimizes better. And, better yet, put an index on o.old_ids to make it go blazing fast.

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

Sidebar

Related Questions

At one place in a code i call an external tool with the system-Call
Can someone tell my why when I have wcf contract: [ServiceContract] public interface IService1
Following scenario: We have to develop a lot of different forms and small or
I am running a application with a LOT of thread. All these threads are
I have a label with a format ever should be: 00:00:00. This timer should
I have two NSScrollView's with scroll synchronized with each other (using Apple's example )
I have an app that uses the FileSystemWatcher to listen for Created and Deleted
I have settled a web synchronization between SQLSERVER 2005 as publisher and SQLEXPRESS as
We have several php projects. The projects use the Zend Framework and we also
I have a winform with a form called MainForm. I have a static class

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.