I am having list of url in table(postgres). I want to process each url.
For that i am having processing program p1(perl).
For some reason i want to run multiple instance of my process program. so each programm select one url from table and perform operation for that url.
each url must be process by only one instance of p1
so whenever url is selected by p1. that url is locked by database and not access by other instance in any way (not for reading also) while operation is not complete.
I have tried "select for update limit 1" statement but another instance is locked not able to select the another row from database it is in waiting state until row lock is not release by the first instance of p1.
I want each url is distibuted to different instance of p1.
So please can anybody help me how to solve this problem.