MySQL transaction support with mixed tables
Asked Answered
I

4

1

It seems like I will be needing transaction with MySQL and I have no idea how should I manage transactions in Mysql with mixed InnoDB/MyISAM tables, It all seems like a huge mess.

You might ask why would I ever want to mix the tables together... the anwer is PERFORMANCE. as many developers have noticed, InnoDB tables generally have bad performance, but in return give higher isolation level etc...

does anyone have any advice regarding this issue?

Inenarrable answered 1/1, 2009 at 10:8 Comment(0)
B
6

I think you are overrating the performance difference between MyISAM and InnoDB. MyISAM is faster in data warehousing situations (such as full table scan reporting, etc..), but InnoDB can actually be faster in many cases with normal OLTP queries.

InnoDB is harder to tune since it has more knobs, but a properly tuned InnoDB system can often have higher throughput than MyISAM due to better locking and better I/O patterns.

Barricade answered 1/1, 2009 at 14:56 Comment(1)
That was going to be my next response. +1Affinitive
A
2

Given that you can't have transactions in MyISAM tables, I am not sure what the actual problem is. Any data you need transactions for must be in an InnoDB table and you manage the transactions using whatever access library you are using or with manual SQL commands.

Affinitive answered 1/1, 2009 at 10:59 Comment(2)
The thing is that all of my data is being accessed, and i would very much like transaction support and still get decent performance without data being duplicated from InnoDB tables to MyISAM tables.Inenarrable
InnoDB will definitely give you "decent performance" many times over.Generalship
P
0

There are definite performance benefits of using exactly one engine.

A server tuned for one engine won't be tuned for the other - both require that you allocate a substantial amount of RAM to its exclusive use - therefore, you can't give them both an optimal amount.

Say you have 8G of ram on your (obviously 64-bit, but still relatively small) database server, you might want to assign about 3/4 of it to your innodb page cache. Alternatively, if you're using MyISAM, you may want about half of it to be your key_buffer. You can't do both.

Pick an engine and use it exclusively. There are ways of getting around performance problems - most of them aren't easy though (i.e. they require redesigning your data structure or your application).

Puberulent answered 6/1, 2009 at 21:25 Comment(0)
B
0

The short answer is that there is no transaction support in MyISAM. If you start a transaction, add or modify data in some InnoDB tables, add or modify data in a MyISAM table, and then you have to rollback, your MyISAM change cannot be removed. To support mixed engines like that, your application has to know that changes to whatever data is stored MyISAM happens "outside" of the transaction.

If you need transactions for some processes, then isolate the data that must be transactionable and put all that data in InnoDB.

Bunni answered 29/4, 2009 at 23:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.