MySQL locking problem

Posted by teehoo on Stack Overflow See other posts from Stack Overflow or by teehoo
Published on 2010-05-22T22:06:59Z Indexed on 2010/05/22 22:10 UTC
Read the original article Hit count: 271

Filed under:
|
|

I have a simple setup of a set of writers and a set of readers working with a MySQL ISAM table. The writers are only inserting rows while the readers are only checking for new rows.

OK, so I know that I don't need a lock in this situation, since I'm not modifying existing rows. However my Writers are accessing one more table that does need a lock. I piece of information seems irrelevant except for the following limitation stated in the MySQL documentation:

A session that requires locks must acquire all the locks that it needs in a single LOCK TABLES statement. While the locks thus obtained are held, the session can access only the locked tables. For example, in the following sequence of statements, an error occurs for the attempt to access t2 because it was not locked in the LOCK TABLES statement:

So to access the table I want to insert rows into, I NEED to lock it, which is causing me performance problems. Any suggestions of how to get around this?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql