Incredibly Basic Question about Indices

From: scott.d.brenner <sbrenner_at_cbnewsb.cb.att.com>
Date: Mon, 8 Feb 1993 21:35:36 GMT
Message-ID: <1993Feb8.213536.9481_at_cbfsb.cb.att.com>


Sorry if this is too basic; I'm not the DBA, just a programmer.

As I understand it, the purpose of indices (or 'indexes' as Oracle likes to call them) is to achieve faster retrieval of data than a full table scan. I know that the index can be on multiple columns and that you can have more than one index on a table. I want to know if using a particular index in the following situation would do me any good or just be a waste of time.

Here's the situation:

I have a table with 20 columns; let's call them A, B, C, etc. for simplicity. I already have an index on columns A & B. If I want to get some rows based on the values in columns A and B, I think the db would use the index to speed the search.

Column F has a value of "Yes" or "No" or NULL. This column is not currently part of any index.

My table may grow to several hundred thousand rows (perhaps as high as 700,000). At any one time, about 450 rows will have a value of "Yes" in column F. All the other rows will have either "No" or NULL in this column.

I need to be able to retrieve all the rows with a "Yes" in column F, but I won't have the values of columns A and B. Would an index on column F help at all? What about an index on columns F, A, and B? I don't really want to have to look through hundreds of thousands of rows to find a few hundred with a particular value. If the index idea won't fly, is there anything else I could do?

Thanks very much for your help. Please respond directly to the address below because I'm too busy right now to keep up with netnews.


Scott D. Brenner                  AT&T Consumer Communications Services
sbrenner_at_attmail.com                          Basking Ridge, New Jersey

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Received on Mon Feb 08 1993 - 22:35:36 CET

Original text of this message