fletchsod
Programmer
- Dec 16, 2002
- 181
Since the Index work different on every of the database software. So, I'm posting a simple question here hoping for an answer.
Let's look at the WHERE clause in the SQL Query.
As you can see, if I create an index for #3 to both the CUSTOMER_ID and USER_ID for quicker response.
The question is do I have to make a sperate index for #1 and #2. (For #1 --> create index for CUSTOMER_ID and a seperate index for USER_ID while the #3 use a seperate index). Or would the #1 and/or #2 still work quickly by taking advantage of the index that was made for #3?? (Yea, may be a bit slower but faster than the one without an index).
Thanks...
P.S. Is there a better documentation somewhere on this one??
Let's look at the WHERE clause in the SQL Query.
Code:
#1 --> SELECT * FROM REPORTS WHERE CUSTOMER_ID = 'blah'
#2 --> SELECT * FROM REPORTS WHERE USER_ID = 'blah'
#3 --> SELECT * FROM REPORTS WHERE CUSTOMER_ID = 'blah' and USER_ID = 'blah'
As you can see, if I create an index for #3 to both the CUSTOMER_ID and USER_ID for quicker response.
The question is do I have to make a sperate index for #1 and #2. (For #1 --> create index for CUSTOMER_ID and a seperate index for USER_ID while the #3 use a seperate index). Or would the #1 and/or #2 still work quickly by taking advantage of the index that was made for #3?? (Yea, may be a bit slower but faster than the one without an index).
Thanks...
P.S. Is there a better documentation somewhere on this one??