Rather than looping over every item in the DB, can you run a select query to check for duplicates? I don't know exactly what you're trying to compare, but something like this might do the trick:
@Ben Sampson , I have to insert new user to the table which contains 5 million records. I have to check whether this new user is already present in table or not. If not, then insert user else update his rating.
Ok, I would approach it by looping over each new user to be added (can't tell if you're adding just 1 or more than 1 user at a time). You can run a select query to see if they exist in the table already, if they do, update them. If they don't then insert them.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community