1

Read question before closing as duplicate pls., because there are many questions about this, but at least I didn't find what I was looking for.

What is clear by now:

 MyIsam is faster at searching strings (much faster)
 InnoDB is faster at joins (much faster)

So my problem is this: I have the following setup:

Two tables, lets say t1 having columns id, bla1, bla2, ..., blan; and t2 having columns t1Id, extra1, extra2, ..., extran.

Table 1 (t1) is InnoDB (needs transactions on it so that's clear). Table 2 (t2) is always used with t1 (is extra data for some specific cases), so there will always be a join between those to where ever t2 appears. That would point to InnoDB. The thing is that after the join a search will be also done (always) for a string inside one of the columns. This would point to MyISAM.

Time to get something is obviously the sum between the join time and the search time. The problem is that if I optimize one I make the other slower.

Bonus facts: Tables are really really big, t2 never needs transactions, row lock or whatever usually impose InnoDB.

What is the better choice? MyISAM or InnoDB?

zozo
  • 8,230
  • 19
  • 79
  • 134

2 Answers2

4

The only way to say for sure is to create two tables, load them with sample data and measure your queries.

In general I would recommend you to use InnoDB:

  1. Since MySQL 5.6 full-text search is also availiable in InnoBD (http://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html) so I think you will lose your MyISAM fast string search as main betefit
  2. With MyISAM you lose not only row-locking support but foreign keys also as well as data integrity + don't forget about MyISAM "crashes"
mpen
  • 272,448
  • 266
  • 850
  • 1,236
Grygoriy Gonchar
  • 3,898
  • 1
  • 24
  • 16
1

I would do this way:

Check here for a free mysql query analyzer.

In this way you can see which is the cost for the join and for the search. Then you should choice the format based on the results! If the search "cost" more, then choice mYisam, for example.

In addition to that: here there is a nice comparison which helps you to find which could be best for you depending even on number of insert etc.

Hope it helps. It's difficult to say: one is better. in GENERAL, It really depends on your query, your data, etc.

Community
  • 1
  • 1
Madthew
  • 686
  • 6
  • 15