MATCH versus LIKE?

Post Reply
james120
Posts: 32
Joined: Tue Aug 31, 2004 7:42 pm

MATCH versus LIKE?

Post by james120 »

I am wondering what the difference between MATCH and LIKE is? If you allow extra characters on either side, it seems like the same thing. Such as MATCHing '%word%' versus LIKing 'word'.

But, I ask because MATCH works much better for a column of small text that I have (just as the manual suggests it would) which is indexed with a normal unique index (not a metamorph index). The difference is huge, so I was wondering perhaps if LIKE requires a metamorph index, so that using LIKE on a normal index is that same as not having an index at all.
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

MATCH versus LIKE?

Post by John »

Yes, LIKE will only use a metamorph index. MATCHES will use a regular index, and works particularly well if you are looking for a column starting with a value, i.e. matches 'word%'. The other difference is that LIKE 'word' respects word boundaries, whereas MATCHES '%word%' will do a substring match.
John Turnbull
Thunderstone Software
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

MATCH versus LIKE?

Post by mark »

also...
MATCHES is a simple single pattern match. LIKE is a whole text query language unto itself. See "METAMORPH INTELLIGENT QUERY LANGUAGE" in the manual. Also see the vortex manual <apicp> settings. Many/most of them are related to LIKE statements.
Post Reply