・The number of index increases too much, it is same as making book fat. Not to increase too much is significant.
・Not mix ASC and DESC. In the case, index is not available.
e.g.
SELECT * FROM t1 ORDER BY key1 DESC, key2 ASC.・If the keys used in where clause and used in order clause are different, index is not available.
e.g.
SELECT * FROM t1 WHERE key21 = 'hoge' AND key22='fuge' ORDER BY key11;
・If you have no idea how to set index which columns, the following order is available
- Create index to all columns
- Execute "explain" to SQL and show index conditions
- Create composite index to keys in possible_keys
・If you used composite index, the left index must be specified in where clause.
No comments:
Post a Comment