oracle11g - SQL: LIKE with OR vs IN -
is there performance difference between following?
name '%expression_1%' or name '%expression_2%' ... or name '%expression_n%'
vs
name in (actual_value_1,actual_value_2,.., actual_value_n)
the in
version potentially much, faster.
the 2 versions not same thing. but, if either meets needs, in
version can take advantage of index on name
. like
version cannot, because pattern starts wildcard.
you write as:
where name 'expression_%'
if meets needs, can take advantage of index on name
.
Comments
Post a Comment