Sample Header Ad - 728x90

How to check if all elements of an array exists in a table?

9 votes
3 answers
59767 views
Lets take an array of ids of size n in the application level. for instance [132,3425,13,13,... 392] where n is bigger than 100k entries. Some of this entries are repeated. I need to check if all of these registers are contained in a MySQL table containing more than 5M entries. Now I'm checking one after another, but this process takes a very long time. How can I make this verification in one single check, or maybe make this more efficient. I would like to know if all of them exists on the table, and, if possible, know which don't already exists on that table.
Asked by Daniel Santos (293 rep)
Jul 4, 2018, 05:24 PM
Last activity: Jul 19, 2022, 08:16 PM