I regularly process the json channel and should only insert the newest users from the feed and ignore existing users.
I think I need ON DUPLICATE KEY UPDATEor INSERT IGNOREbased on some searches, but I'm not quite sure why I ask - like this:
users
1 John
2 Bob
Partial JSON:
{ userid:1, name:'John' },
{ userid:2, name:'Bob' },
{ userid:3, name:'Jeff' }
From this feed, I only want to insert Jeff. I could make a simple loop for all users and make a simple SELECT query and see if the user ID is already in the table if I do not do INSERT, however I suspect that this will not be an efficient and practical method.
By the way, I use Zend_Db to interact with the database, if someone wants to satisfy a specific answer :) I am not against the general strategic decision, though.