LIKE关键字在用于查找数据库中的记录时效率如何? [英] How efficient is the LIKE keyword when used to locate records in database ?

查看:72
本文介绍了LIKE关键字在用于查找数据库中的记录时效率如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与在where子句中使用'='相比,LIKE关键字在用于查找数据库中的记录时的效率如何。



换句话说,有多好与'='符号相比,LIKE关键字用于定位记录?

How efficient is the LIKE keyword when used to locate records in database as compared to the using '=' in a where clause.

Put differently, how well the LIKE keyword be used to locate record as compared with the '=' symbol?

推荐答案

LIKE仅适用于静态值。应该避免使用数据库。



和=运算符在性能方面比LIKE更有效。





LIKE获得的唯一优势是使用通配符%,_,。*等搜索匹配的值,这是您无法做到的=。



use-or-like-to-compare-strings-in-sql [ ^ ]



sql-like-vs-performance [ ^ ]
LIKE is good to used only against static values. It should be avoided to used against a database.

and "=" operator is more efficient than LIKE in terms of performance.


The only advantage you get with LIKE is to search the matching values with wildcards "%","_",".*" etc , which you can not do with "=".

use-or-like-to-compare-strings-in-sql[^]

sql-like-vs-performance[^]


see ...

http://stackoverflow.com/quest离子/ 6142235 / sql-like-vs-performance [ ^ ]

http ://myitforum.com/cs2/blogs/jnelson/archive/2007/11/16/108354.aspx [ ^ ]

http://use-the-index-luke.com/sql/where-clause/searching-for-ranges/喜欢性能调整 [ ^ ]
see...
http://stackoverflow.com/questions/6142235/sql-like-vs-performance[^]
http://myitforum.com/cs2/blogs/jnelson/archive/2007/11/16/108354.aspx[^]
http://use-the-index-luke.com/sql/where-clause/searching-for-ranges/like-performance-tuning[^]


这篇关于LIKE关键字在用于查找数据库中的记录时效率如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆