I am using mySQL to develop a database collected from internet sources. Python is used for the spider coding, but I'm having issues with the mySQL portion. I'm pretty new to mySQL, so I'm a bit lost.
I need a way to lock a single row of a table and then unlock it. We have multiple machines access a single job table and picking the jobs labelled pending. Unfortunately, without locking and unlocking, the machines will, in milliseconds, pick the same jobs and screw up the whole proccess. We are currently locking the whole table, selecting a job, writing its status as in progress, then unlocking the table. That wastes time. Any ideas on how to make this more efficient? I was thinking, lock the single row being accessed, then the other rows could be accessed by the other machines. I do not, however, have any clue how to do that. Thanks in advance.
poeticinsanity
2
Light Poster
Recommended Answers
Jump to PostThis depends on the database engine you're currently using. By default MySQL uses MyISAM (Also uses MyISAM internally). However, MyISAM only supports table-level locking so when you're writing it locks the entire table. InnoDB on the other hand uses row-level locking along with a host of other features like foreign …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.