Home  >  Article  >  Backend Development  >  直接查询数据库 跟正则哪个快

直接查询数据库 跟正则哪个快

WBOY
WBOYOriginal
2016-06-13 12:15:02905browse

直接查询数据库 和正则哪个快?
比如 一个电视剧 有2000条链接 都是分开存的一条一条

现在加入新的链接 查询是否为重复链接 判断是否存在 一条的查询时间为0.05 如果是一次加入2000条需要判断的新链接需要花的时间长

跟我把两千条url全部取出用正则匹配判断是否 那个速度快呢?等于也是正则判断两千次 和数据库 查询2000次 那个快呢
------解决思路----------------------
只需建立唯一索引即可

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