Join performance of MyISAM and Innodb

May 29, 2006
Author
Peter Zaitsev
Share this Post:

We had discussion today which involved benchmarks of Join speed for MyISAM and Innodb storage engines for CPU bound workload, this is when data size is small enough to fit in memory and so buffer pool.

I tested very simple table, having with about 20.000 rows in it on 32bit Linux. The columns “id” “i” and “c” were populated with same integers so we can allow the same job to be done using different kinds of columns – primary key, integer indexed column and indexed char column. The query is also trivial – the point was to make sure it is not index covered query so it reads the rows and it does not return many rows. I varied the join clause to be id, i and C columns appropriately.

The result I’ve got are as follows

 

Storage Engine ID I C
MyISAM 0.24s 0.27s 1.19s
Innodb 0.07s 0.30s 0.38s

As you see in such circumstances Innodb is actually faster than MyISAM in 2 cases out of 3. I guess the reasons are the following:

 

    • Innodb primary key joins are very fast as data is clustered together with index and generally highly optimized

 

    • Innodb builds hash indexes which helps to speed up lookup by indexes by passing BTREE index and using hash, which is faster

 

    • MyISAM does compression for character keys which makes it perform slower for random lookups

 

    • MyISAM generally has lower processing overhead due to its simplicity

 

    • MyISAM still a bit better by primary key join than for secondary key join. I guess because it knows for sure there is no more than one row which matches the index, so there is no need for MySQL to request next row matching index

 

Note: This applies to CPU bound workload with all content fitting in memory. In other cases situation is very different and MyISAM compression for char keys could frequently positevely impact performance.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved