Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> concatenated index
Dear all,
I have a basic doubt. I grew up (in Oracle) believing that for the concatenated indexes to be used by a query the ordering of the columns in the where clause was very important. But now I have doubts I have a table test and a composite index on it.
CREATE TABLE TEST (
A NUMBER, B NUMBER, C NUMBER,
Then tried some queries with explain plan. There is only one row which matches this criteria.
SQL> explain plan for
2 select * from test
3 where a= 112
4 and b=113
5 and c=114;
Explained.
SQL> @plan
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart|Pstop |
6 rows selected.
SQL> explain plan for
2 select * from test
3 where a= 112
4 and c=114
5 and b=113;
Explained.
SQL> @plan
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart|Pstop |
6 rows selected.
SQL> explain plan for
2 select * from test
3 where b=113
4 and a= 112
5 and c=114;
Explained.
SQL> @plan
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart|Pstop |
6 rows selected.
SQL> explain plan for
2 select * from test
3 where b=113
4 and c=114
5 and a= 112;
Explained.
SQL> @plan
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart|Pstop |
6 rows selected.
SQL> explain plan for
2 select * from test
3 where b=113
4 and c=114;
Explained.
SQL> @plan
Plan Table
| Operation | Name | Rows | Bytes| Cost | Pstart|Pstop |
Now I am at loss. I know this is something very basic. But I am unable to understand why the index is being used even when the order of the columns in the where clause is changed.
Oracle version 8.1.7.2.
Please enlighten me
Thanks in advance
Novice
No more Oracle Certifiable DBA
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Novice DBA
INET: [EMAIL PROTECTED]
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting servicesto: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Mon Jul 07 2003 - 21:51:12 CDT
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message