If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I cannot find the answer in the Oracle documentation (http://
download-west.oracle.com/otndoc/oracle9i/901_doc/server.901/a88856/c11schem.
htm#3239) or in a search with google. And this must be easy to solve for
most of you experts.

I need to do an applet that make some SQL queries to a Oracle db. One of
them is to query an indexed table. It is a secondary index and the key is on
multiples columns: {command, article}. I guess the index was created with
something like:

create index i on commands(command, article);

I need to do a query of the form:

select * from commands where command = 10;

And i need to know if the index will be internally used to perform the query
or all the table will be scanned. In other words, is it possible to use a
single column to perform a search in a multiple columns index?

When you have an index over commands(command, article) and execute
select * from commands where command = 10;
the database will do something called an index range scan. The optimizer uses a range scan when the optimizer finds one or more leading columns of an index (command in your case) in conditions (where command = 10 in your case).http://download-west.oracle.com/otnd...mops.htm#45076

As i understand, this mean the database will find the first node with command=10 in the index, and then subsequent nodes may also contain pointers to the matching records. The database will walk recursively into the nodes until command!=10 is found.