Home  >  Article  >  Backend Development  >  php 面试碰到过的问题 在此做下记录_PHP

php 面试碰到过的问题 在此做下记录_PHP

WBOY
WBOYOriginal
2016-06-01 12:16:59848browse

代码优化
复制代码 代码如下:
for($i=0;$iarray_push($week,$arr);
}

复制代码 代码如下:
for($i=0;$i$week[]=$arr[$i];
}
//这样就没有了调用函数的额外负担

建立索引的好处和坏处
好处:查询时就会先去索引列表中一次定位到特定值的行数,大大减少遍历匹配的行数
坏处:无论如何都要查询此表,字段大量重复值,增加索引也没有什么意义
记录比较少的,增加索引不会带来速度的优化反而浪费了存储空间,因为索引是需要存 储空间的,而且有个致命缺点是对于update|insert|delete的每次执行,字段的索引都必须重新计算更新

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn