473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

backwards LIKE matching

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

Sep 7 '06 #1
1 2926

"Ariel" <as****@dsgml.comwrote in message
news:S7******************************@comcast.com. ..
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
You could define a function based index that is the substring of the domain.
Jim
Sep 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Chris | last post by:
Can anybody help. I need to read a txt file backwords line by line. Can anybody help me do this. Thanks Chris
176
by: Thomas Reichelt | last post by:
Moin, short question: is there any language combining the syntax, flexibility and great programming experience of Python with static typing? Is there a project to add static typing to Python? ...
15
by: SK | last post by:
Hey folks, I am searching for a string (say "ABC") backwards in a file. First I seek to the end. Then I try to make a check like - do { file.clear (); file.get(c); file.seekg(-2,...
2
by: mjbaz | last post by:
Hi Everyone: I am experiencing a problem which may have something to do with different Access versions. Approximately 4 years ago, I wrote a small program for a law firm. They recently...
6
by: Neil Patel | last post by:
I have a log file that puts the most recent record at the bottom of the file. Each line is delimited by a \r\n Does anyone know how to seek to the end of the file and start reading backwards?
70
by: py | last post by:
I have function which takes an argument. My code needs that argument to be an iterable (something i can loop over)...so I dont care if its a list, tuple, etc. So I need a way to make sure that...
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
150
by: tony | last post by:
If you have any PHP scripts which will not work in the current releases due to breaks in backwards compatibility then take a look at http://www.tonymarston.net/php-mysql/bc-is-everything.html and...
11
by: tech | last post by:
Hi, I need a function to specify a match pattern including using wildcard characters as below to find chars in a std::string. The match pattern can contain the wildcard characters "*" and "?",...
1
by: sora | last post by:
Hi, I've developed a MFC program under VS 6.0. My debugger *was* working fine and I've used it often for my project. Then, one day, the errors below appear and they prevent me from using the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.