I should know the answer to this, but it has been too long since tuning class. I have a client that currently has a table similar to the following:
Currently, there are two indexes, one on the CALL_DATE field, and another off the PHONE_NUM, CUST_CODE, and CALL_DATE.
Now, he is looking to alter the table. A CALL_HISTORY record may be tracked by either the actual phone number itself, or by the business phone number. Picture a large company with a lot of different phone numbers. It is probably one person's job to maintain the phone services, but there are hundreds of separate phone numbers. A record could be based off the specific phone number that called in, or the phone number of the person in charge of arranging all the phone service.
So, there will be another field added to each record:
Each record will have either the phone number, the business phone number, or both. He had intended to create a new index off the business phone number so that he had both phone numbers separately indexed.
The concern is when we query off this table, searching for values in either the phone number or the business phone number, that we may not use the indexes and then do a full table scan. Is there a way to design this so that it can be properly indexed to search in either one field or the other?
Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
Code:
CALL_HISTORY
PHONE_NUM VARCHAR2(10) NOT NULL
CUST_CODE VARCHAR2(3) NOT NULL
CALL_DATE DATE NOT NULL
...
Now, he is looking to alter the table. A CALL_HISTORY record may be tracked by either the actual phone number itself, or by the business phone number. Picture a large company with a lot of different phone numbers. It is probably one person's job to maintain the phone services, but there are hundreds of separate phone numbers. A record could be based off the specific phone number that called in, or the phone number of the person in charge of arranging all the phone service.
So, there will be another field added to each record:
Code:
CALL_HISTORY
PHONE_NUM VARCHAR2(10) NULL
BUS_PHONE_NUM VARCHAR2(10) NULL
CUST_CODE VARCHAR2(3) NOT NULL
CALL_DATE DATE NOT NULL
...
The concern is when we query off this table, searching for values in either the phone number or the business phone number, that we may not use the indexes and then do a full table scan. Is there a way to design this so that it can be properly indexed to search in either one field or the other?
Terry
**************************
* General Disclaimer - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...