Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm currently unable to insert rows concurrently in an XtraDB table on Percona Server 5.1.54. I had the same problem with a similar version of MySQL. My table definition is as follows.

CREATE TABLE `test` (
  `a` int(11) NOT NULL DEFAULT '0',
  `b` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=MyISAM

If in on one connection, I execute something like INSERT INTO test VALUES (0, sleep(60)) and in a second process, INSERT INTO test VALUES (1, 0), the second insert will wait for the first to complete. Note that innodb_table_locks is off. Is there something I'm missing, or is this just not possible?

Update

As Randy points out below, I created a MyISAM table during testing and then assumed that concurrent inserts weren't possible for my other tables (which are InnoDB). I actually don't have a problem with InnoDB tables.

share|improve this question
    
concurrent inserts should never be a problem on a database. however, why are you doing a sleep60? This sounds like a threading problem, not a database problem. Is it necessary for you to do the sleep first? –  jcolebrand Feb 2 '11 at 17:08
    
Some database engines don't support concurrent inserts. Some support concurrent inserts only with a given set of configuration parameters. In any case, the sleep was simply to ensure that the first insert was still running while the second insert executed, purely to show that concurrent inserts weren't working. –  Michael Mior Feb 2 '11 at 21:14
add comment

1 Answer 1

up vote 3 down vote accepted

You might notice the problem is :

ENGINE=MyISAM

Try changing that to:

ENGINE=InnoDB
share|improve this answer
    
Wow...that's embarrassing. Forget I asked the question. It was obviously too late a night. Thanks though Randy :) Apparently I can't vote down my own post, everyone else feel free to. –  Michael Mior Feb 2 '11 at 21:12
    
Hey bro, we all been there! –  randy melder Feb 2 '11 at 21:49
    
@Michael Mior This is all the reason to leave it up. Somebody else will likely facepalm as well and then you'll get the credit (unadvertised of course) for helping them. –  jcolebrand Feb 2 '11 at 22:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.