HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Optimal engine for small lookup tables in MySQL

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
enginetablesoptimalmysqlsmallforlookup

Problem

I have following question: I am designing web application with several dozens of small lookup tables: These tables usualy contain three columns (ID, Name, Description) and a couple of rows (mostly fewer than 50, max is about 450).

These lookup tables are expected to change only rarely (they come from standard, which changes once in several years) and will be used only to:

  • fill options in html select



  • be joined to other records in reports



There will be only SELECT statements on these tables 99 % of times, but there will be quite a lot of them.

I am wondering, which database engine would be most efficient to use?

Here are my considerations:


MEMORY



  • pro: very fast



  • con: if the server crashes, all data are lost and need to be recreated



  • con: does not support foreign keys





compressed MyISAM



  • pro: fast



  • con: does not support foreign keys





InnoDB



  • pro: foreign key support




What I would like to ask, is whether there will be significant advantage in using something different than InnoDB - performance-wise

Thanks, Zbynek

Solution

I answered a similar question in Aug 2011 : Which DBMS is good for super-fast reads and a simple data structure?

Since you are asking about MySQL and which storage engine. To be honest, it is hard to say because there are rare occasions when MyISAM can outperform InnoDB when it comes to SELECTs.

Here are some of my past posts on this controversy

  • Sep 20, 2011 : Best of MyISAM and InnoDB



  • May 03, 2012 : Which is faster, InnoDB or MyISAM?



  • Jul 05, 2012 : InnoDB vs MyISAM with many indexes



  • Sep 26, 2012 : Choosing MyISAM over InnoDB for these project requirements; and long term options



You might asking right now : Why would I ever favor MyISAM over InnoDB ?

Take a look at this diagram (created by Vadim Tkachenko, Percona CTO)

MyISAM will cache indexes and your table would have 2 indexes (PRIMARY KEY on id and an index of Name). On the other hand, InnoDB has too many moving parts to accommodate for, especially if the InnoDB Buffer Pool has to load and dismiss 16K pages periodically.

To be fair, you should do an experiment.

  • Go to my post What are the main differences between InnoDB and MyISAM?. Read it carefully.



  • Setup a server using MyISAM and all your tables using ROW_FORMAT=Fixed (See my post What is the performance impact of using CHAR vs VARCHAR on a fixed-size field?) and use a large key_buffer_size.



  • Setup another server using InnoDB and a large innodb_buffer_pool_size.



  • Add your data to both server and query them like crazy.



This will give you the best assessment for Storage Engine choice for your dataset.
GIVE IT A TRY !!!

Context

StackExchange Database Administrators Q#102293, answer score: 2

Revisions (0)

No revisions yet.