Basically, the question is:
In default MySQL configuration with InnoDB, is insert and update in on transaction faster then the same operation in two separate transactions.
My assumption that it should be faster when you do in transaction but it would be great if somebody can example if it is really faster and why.
I believe the answer depends on workload, so in which cases single transaction should be faster and in which cases two transactions should be faster.
Does it matter which MySQL version is used? Any option influencing this?
For this simple case I would say that it is faster. When the number of actions inside the big transactions are large it might be slower.
And it also depends on configuration. In 5.5 and older leaving innodb_flush_log_at_trx_commit at it’s default of 1 gives a real penalty on each transaction and doing the insert + update outside a transaction actuallt causes two separate transactions and two separete flushes to log. In 5.6 this is faster.