What are your most common SQL optimization that you used?
Reducing the amount of data that is returned, by only returning the fields required and only returning the rows required. This is the most common, as you do it for every query that returns data.
With ENGINE=InnoDB, the above advice especially applies to avoiding unnecessary fetching of TEXT
and BLOB
columns since they may be stored in a different location (thereby costing extra I/O).
Adding indexes. This is not done as frequently, as some tables doesn't need any other index than the one created for the primary key.