Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Performance of REGEXP_LIKE vs LIKE?

Performance of REGEXP_LIKE vs LIKE?

From: <zstringer999_at_gmail.com>
Date: 18 Apr 2007 13:52:41 -0700
Message-ID: <1176929561.159734.57280@n76g2000hsh.googlegroups.com>


Hello fellow netters,

I'm curious if anyone has done any performance testing of REGEXP_LIKE vs LIKE. There are certain situations where the syntax of REGEXP_LIKE is cleaner and shorter than the comparable LIKE expression. A common search request for us involves doing a case-insensitive, wildcard search of a 3 million record table, for a series of text strings.

For example:

SELECT *
  FROM big_table bt

 WHERE UPPER(TRIM(bt.txt)) LIKE '%ABRASION%'
    OR UPPER(TRIM(bt.txt)) LIKE '%DERMATOLOGICAL%'
    OR UPPER(TRIM(bt.txt)) LIKE '%PSORIASIS%'

The equivalent regular expression search is:

SELECT *
  FROM big_table bt
 WHERE REGEXP_LIKE(UPPER(TRIM(bt.txt)),

                   '(ABRASION|DERMATOLOGICAL|PSORIASIS)')

The regular expression syntax is cleaner, especially when you have a lot of strings to search for! However, the LIKE expression runs in 20 seconds, while the REGEXP_LIKE one runs in 60 seconds. Has anyone else noticed this? Any way to speed it up?

BTW there's some kind of limit to the string you can pass to REGEXP_LIKE. You'll get the error message: ORA-12733: regular expression too long

Thanks,
Zstringer Received on Wed Apr 18 2007 - 15:52:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US