Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> index-organized table question
Greetings all,
Say I have two main tables in a M:M relationship, and a junction table resolving the relationship, like so:
create table staff
(staff_id number PRIMARY KEY
, name varchar2(50)
, <<other cols>>) ;
create table projects
(proj_id number PRIMARY KEY
, name varchar2(50)
, mgr_id number
, <<other cols>>) ;
create table staff_projects
(staff_id number
, proj_id number
, CONSTRAINT staff_projects_pk
PRIMARY KEY (staff_id, proj_id)
Queries that join staff_projects to projects to pull project info for a given staff_id should be really fast, since staff_id is the leading column in the index created to enforce the PK on staff_projects (right?)--and in fact, the staff_projects table itself shouldn't need to be touched, since all the needed info is in this index (also right?).
If I want to speed lookups of staff info for a given proj_id, I can create another unique index on staff_projects(proj_id, staff_id). There again, the staff_projects table shouldn't need to be touched, b/c all the info is in the index.
At this point, it seems like the table is sort of superflous--all the info in it is better accessible in the two indexes. If that's right--is there an advantage in making staff_projects an index organized table?
Thanks!
-Roy
Roy Pardee
Programmer/Analyst/DBA
SWFPAC Lockheed Martin IT
Extension 8487
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Pardee, Roy E INET: roy.e.pardee_at_lmco.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (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 Wed May 28 2003 - 11:45:12 CDT