something about mysql database index
TRANSCRIPT
Insert performance Batch INSERT and REPLACE Use LOAD DATA instead of INSERT Other tricks
Forbidden Foreign keyForbidden IndexRebuild Index
Make sure you strike a good balance for indexing Too many adversely affects data input Too few adversely affects reads
Order of columns in an index matters! Covering indexes are the fastest query possible
Consider the impact of duplicate rows Avoid SELECT DISTINCT if it doesn’t cause a
problem Use UNION ALL instead of UNION if duplicate
rows are acceptable Use foreign key as index or create independent
index Despite what you see in examples, avoid
SELECT *
Operators in the WHERE clause make a big difference Avoid <> and LIKE Use EXISTS, NOT EXISTS, and LEFT JOINS instead
of NOT IN If you must use LIKE, make the first character a
literal
Don’t use ORDER BY unless you really need it Don’t use Count(…) where to protect data
integeration Don't use ORDER BY RAND() when data is
huge
http://dev.mysql.com/doc/refman/5.1/zh/optimization.html#insert-speed http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/ http://www.informit.com/articles/article.aspx?p=377652