Setting the right MYSQL table options
I have a database table for user profiles. It's comprised of a primary key, user id, full name, email, location, and abo开发者_如何转开发ut me.
I'm having difficulty determining the correct options for this type of database table.
Storage Engine:
Collation:
auto_increment:
row_format:
Currently I'm using InnoDB to allow foreign keys and that's the only option I'm certain about.
In most cases, phpMyAdmin's default setting are fine.
Auto-increment ist mainly used for primary-key id columns if type int, which should identify individual entires.
In case space is not of importance, you may set ROW_FORMAT to FIXED. This options restrict the storage size of each row in constant size of bytes - even if some columns are variable sized strings (varchar).
Collation and related settings is a bit complicated. I'd propose to use defaults or review the manuals.
Choosing between MyISAM or InnoDB isn't only a choice of features, but also of access patterns. Often MyISAM is fine, in certain other cases InnoDB is better. The choice should e.g. be influenced by the number and relative weight of reads and updates.
精彩评论