Question

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

Was it helpful?

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

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)

InnoDB Architecture

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.

This will give you the best assessment for Storage Engine choice for your dataset.

GIVE IT A TRY !!!

OTHER TIPS

  • "Compressed MyISAM" -- what is that? Maybe "Archive"?
  • Compression is not needed; the tables are too small, and will quickly be fully cached.
  • FOREIGN KEYS -- Why? You have debugged you code, haven't you? There will be no dangling things to check.
  • MEMORY is not unreasonable, if you write 'reload' code that executes whenever you bring up the server, and any updates to the table are writen to both to the MEMORY table an the persistent backup.
  • MyISAM ROW_FORMAT=FIXED -- that's an old wive's tale; use DYNAMIC and VARCHARs.
  • InnoDB's "clustered" PRIMARY KEY makes lookups a little faster than MyISAM for your purpose.
  • Do you know that the lookup tables are causing a noticeable slowdown? I seriously doubt that they are.
  • Do not use lookup tables for "continuous" values, such as FLOATs and DATEs.

I vote for InnoDB without FKs.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top