dbTalk Databases Forums  

backwards LIKE matching

comp.database.oracle comp.database.oracle


Discuss backwards LIKE matching in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ariel
 
Posts: n/a

Default backwards LIKE matching - 09-07-2006 , 03:27 AM






I'm reversing the normal order of LIKE, with the column on the right side:

SELECT domain
FROM tbl_domain
WHERE 'com.hotmail.subdomain' LIKE domain || '%'

This works, but will this query use an index? If not, is there any way I
can optimize this? I have flexibility in how I will store the data (as
you can see I reversed the domain sections for this test).

If I store .hotmail.com (stored here as com.hotmail.) in the database, I
want to be able to match subdomain.hotmail.com, etc. Or if I store
..mail.google.com in the DB, I want to match subdomain.mail.google.com
(but if .mail.google.com is stored in the DB, then .google.com should
NOT match).

The query as written, technically should be index search able - it just
needs to look for values starting with c then work through each letter
of the rest of com.hotmail.subdomain and only look at values starting
with each prefix, but I don't know if oracle actually does that.

Perhaps a totally different storage method?

-Ariel

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.