|
-
Performance trying to do a 'best match'
I have an application that routes telephone calls based on the phone number the user dials and selecting from a list of route plans the telephone company operator creates. The complexity comes in because the route selection table will give a list of partial phone number with variable granularity. For example part of the list may look like this (numbers not real)
4 (country zone 4)
44 (UK)
4424 (UK London)
442467 (UK London Mobile)
if the user dials 442467123456789 I need the data from the last entry, if the user dials 442498123456789 then I need the data from the 4424 entry, if the user dials 443666123456789 then I need the 44 data and so on. The problem is performance, the table contains > 200,000 entries and when I use my sql statement which is:
SELECT digits FROM routestepent WHERE 'DEFAULT' = tblnm AND ‘6022241234' LIKE digits||'%' ORDER BY LENGTH(digits) DESC
digits is the column that contains the list of numbers to match to
tblnm is a column that specifies a group of entries that make up a "route table" form the telephone company's standpoint.
6022241234 as an example I plugged in and used for testing, in the app we use whatever the user dials
it works but it takes close to 1/2 second to execute which in the telephony world is wholey unacceptable. It seems oracle is not using the index on the digits field because I am using the LIKE operator.
thanks.
Last edited by GSimpson; 09-08-2005 at 06:48 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|