You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Neil Xu <ne...@gmail.com> on 2010/08/10 09:40:52 UTC

Is INSTR faster than LIKE

Hi, all,

    I am wondering whether INSTR will run faster than LIKE, in all cases, or
in some cases?

    for example, INSTR(url, 'http://www.google.com/') = 1     VS url like '
http://www.google.com/%'
                       INSTR(url, 'google') = 0     VS not url like
'%google%'
                       INSTR(url, 'google') > 0     VS url like '%google%'


   who can give some details, Thanks!



Chocobo

2010-08-10

Re: Is INSTR faster than LIKE

Posted by Zheng Shao <zs...@gmail.com>.
Hive LIKE is specially optimized for prefix, suffix and instr
operations, so it's not likely to see a difference.

Zheng

On Tue, Aug 10, 2010 at 12:40 AM, Neil Xu <ne...@gmail.com> wrote:
> Hi, all,
>
>     I am wondering whether INSTR will run faster than LIKE, in all cases, or
> in some cases?
>
>     for example, INSTR(url, 'http://www.google.com/') = 1     VS url like
> 'http://www.google.com/%'
>                        INSTR(url, 'google') = 0     VS not url like
> '%google%'
>                        INSTR(url, 'google') > 0     VS url like '%google%'
>
>
>    who can give some details, Thanks!
>
>
>
> Chocobo
>
> 2010-08-10
>



-- 
Yours,
Zheng
http://www.linkedin.com/in/zshao