2

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.

2
  • 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, 2011 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. Feb 2, 2011 at 21:14

1 Answer 1

4

You might notice the problem is :

ENGINE=MyISAM

Try changing that to:

ENGINE=InnoDB
3
  • 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. Feb 2, 2011 at 21:12
  • Hey bro, we all been there!
    – randomx
    Feb 2, 2011 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, 2011 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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