mysql query efficiently background

       Speaking mysql query efficiency, it can not be bypassed indexing problems, and mysql innodb storage engine index is the top priority, innodb index includes "primary key index (clustered index)," that is, the actual data and the primary key data storage together index. Apart innodb secondary index is the primary key index, the data area of ​​the two indexes stored in the leaf node is the primary key, mysql each page has a data size of 16k, after insertion in innodb The unique key data has been in good order the data page index structure being not too much to explain.

That we can create a new secondary index "nearly" principle to create, create a reference sql statement: select count (distinct (cost (xx, xx))) / count (*);

The total number and the total number of data de-duplication involved in Create column indexes do comparison, the result tends to 1, then query the index, the better the effect. Because the more close to 0 indicates little data gaps, the higher the cost of the scanned data.

mysql query part comprising, (1) sql actuator, (2) sql optimizer.

 

Guess you like

Origin www.cnblogs.com/zzq-include/p/12164978.html