1.Good schema design is pretty universal, but of course MySQL has special implementation details to consider. In a nutshell, it’s a good idea to keep things as small and simple as you can. MySQL likes simplicity, and so will the people who have to wo…
1.数据类型 1.1.几个参考优化原则 a. 更小的通常更好 i.更小的数据类型,占用更少磁盘.内存和CPU缓存,需要的CPU周期更少 ii.如果无法确定哪个数据类型是最好的,就选择不会超过范围的最小类型 b. 简单就好 i.简单数据类型的操作仅需少量的CPU周期,EX:整形比字符操作代价更低 c. 尽量避免null i.null将使索引.索引统计和值比较更复杂. ii.可null的列需要更多空间 iii.在MyISAM引擎里甚至还可能导致固定大小的索引变成可变大小的索引 1.2.整数类型…
1.MySQL架构图 2.事务的隔离性 事务的隔离性是specific rules for which changes are and aren’t visible inside and outside a transaction (1)READ UNCOMMITTED In the READ UNCOMMITTED isolation level, transactions can view the results of uncommitted transactions. At this le…
一.怎样用索引才高效 1.隔离索引列 MySQL generally can’t use indexes on columns unless the columns are isolated in the query. “Isolating” the column means it should not be part of an expression or be inside a function in the query. 如,以下的查询不能用actor_id索引 SELECT actor_…
一. 1.什么是hash index A hash index is built on a hash table and is useful only for exact lookups that use every column in the index. For each row, the storage engine computes a hash code of the indexed columns, which is a small value that will probably…
一. 1.什么是B-Tree indexes? The general idea of a B-Tree is that all the values are stored in order, and each leaf page is the same distance from the root. A B-Tree index speeds up data access because the storage engine doesn’t have to scan the whole tab…