Schema optimization

  • The smaller the query the better (usually)
  • Simple is good:
    • INT is faster than CHAR
    • Dates and times are better when used with built-in types instead of VARCHAR
    • IP are better stored as INT (personally I don't like this, but ...)
  • Avoid NULL:
    • It uses more space and special features to store and compare null fields.
    • Use 0 or other INT instead.
    • It's specially useful for indexing as well