You can optimize your database structure by keeping data a small and fixed size, by indexing appropriately, and by choosing an appropriate table type.
Indexes are used to find records quickly according to the index column value.
An index will be used in a query when the query is based on the index column or columns or a leftmost prefix of the index columns .
OPTIMIZE TABLE tablename ; performs housekeeping similar to defragging your disk.