MySQL has two great features which historical haven't played well together:
- Index-only queries: In some cases, MySQL can resolve a query directly from the index, without having to read the underlying table.
- Prefix indexes: This allows you to specify how many bytes to index, which can reduce index size or allow you to index the larger data types (ie. BLOB/TEXT). The drawback being that the entire field isn't stored in the index, so you can't do index-only queries.
One common optimization we do to reduce IOP consumption on database servers is to add additional columns to indexes in order to allow more queries to be index-only. However, sometimes we have these large TEXT fields in order to allow for larger content -- even if the content is normally very small.
For example:
CREATE TABLE tbl (
…
[Read more]