| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: all foreign key should have index?
Christopher Browne wrote:
> > Gene Wirchenko wrote: > >
> the >> > index for this field value?".> >> > Again, it does come down to the size of the table. A table with a maximum of about 10 rows is
> >> >
> > > > Then what is the other way? What other mechanism allows efficient > > searching of a table without a full search? > > Sometimes, if the table is fairly small, a full search is in fact the > fastest method. Pointedly, if the table is likely to fit in one page, > then a full search guarantees finding the result with one disk access. > In comparison, any index-like indirection would require two disk > accesses, and therefore be more expensive than full search. Indeed, > the result of that is that full scan is "probably optimal" if the > table fits into two pages of disk.
In my experience, any table that is that small is rarely the subject of a FK search. It is usually the FK in the larger tables that requires an index.
> Some people assume that "index" is synonymous with "B-tree";
An index is just a mechanism to locate one or more records quickly.
> there are > other data structures that they may not believe should be called an > "index." Pointedly, hashing is a sometimes-efficient mechanism for > searching for data. (It tends to seem less attractive when applied to > disk-based structures than it is for in-memory data, but that's noth > particularly relevant here...)
And I am not one of these people. Indexes can be created with any data structure in mind. A developer/database designer may even decide to create their own index using database tables (something that we had to do).
--Received on Fri Feb 03 2006 - 04:51:52 CST
![]() |
![]() |