As always, I apologize if this is a stupid question (two questions, actually). I’m not a DBA, so I know very little about indexes. My questions are:
-
Is there any cutoff point (in terms of number of rows) at which an index would be pointless? For example, is there any benefit to an index on a lookup table with 10-20 rows?
-
I’ve read some things about covering indexes in Oracle, and the concept makes sense in that the data can be retrieved directly from the index and a trip to the table is unnecessary. How can I tell if an index is a covering index? Is this a value set when the index is created, or by default based on the rows that the index includes?
I hope this makes sense.
Richard Foote has a series of blog posts on indexes for small tables. The short answer is probably not (but the long answer is much more interesting).
A covering index is a general term for an index that contains all the columns that are part of either the SELECT list or the WHERE clause for a table. It is not a property of an index– any index can be a covering index for some query. It is something that is specific to a query and to the indexes available to the optimizer.