Skip to main content

Posts

Showing posts from April, 2012

InnoDB Performance Tuning Tips

Storage Layout Tips In  InnoDB , having a long  PRIMARY KEY  wastes a lot of disk space because its value must be stored with every secondary index record. (See Section 14.2.10, “ InnoDB  Table and Index Structures” .) Create an AUTO_INCREMENT  column as the primary key if your primary key is long. Use the  VARCHAR  data type instead of  CHAR  if you are storing variable-length strings or if the column may contain many  NULL  values. A  CHAR( N ) column always takes  N  characters to store data, even if the string is shorter or its value is  NULL . Smaller tables fit better in the buffer pool and reduce disk I/O. When using  COMPACT  row format (the default  InnoDB  format in MySQL 5.0) and variable-length character sets, such as  utf8  or  sjis ,  CHAR( N )  will occupy a variable amount of space, at least  N  bytes. Transaction Managemen...