Will deadlocks affect me, even if I don't use transactions?
We want to switch from MyISAM to InnoDB for several reasons, but we do not intend to use transactions with BEGIN/COMMIT etc.
Is there any case where deadlocks can occur just by using SELECT, INSERT, UPDATE and DELETE? We use some JOIN's and we have lots of INDEX's of course.
If I convert all my tables to InnoDB, how can I test the site in a real life simulation? If only a couple of people click around the site, it's not gonna be anything like when 100's of 开发者_StackOverflowusers are online clicking, adding, deleting etc. Do you recommend any tool to do this?
Thank you in advance for any tips! :)
You have 2 very different questions here.
1 Yes, deadlocks can happen even when you don't explicitly use transactions, since "under the hood" row-level locking is used for all insert/update/delete statements. Read more here.
2 In general, stress/performance testing is not a trivial task and there aren't many generic tools that will do it well. How do you stress test other database changes (adding/changing/removing indexes, table schema changes)?
In short, deadlocks can occur because (default settings is AUTOCOMMIT = ON
, meaning) every single statement (SELECT
, UPDATE
, INSERT
, DELETE
) is treated as a separate transaction in InnoDB - and is autocommitted immediately after execution.
See: Implicit Transaction Commit and Rollback
But, as @Johan points, they should be less of a problem in InnoDB than MyISAM, as row-level locking is used, wherever possible.
Also check @MarkR's answer in this question, for more details: Explain Inexplicable Deadlock
For the stress testing, I've heard about but haven't used Super Smack, which is a benchmarking and stress testing tool for MySQL and PostgreSQL.
But since most users will probably be using your web interface, any stress testing tool for such an interface may be enough for your needs.
精彩评论