Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> index-organized table question

index-organized table question

From: Pardee, Roy E <roy.e.pardee_at_lmco.com>
Date: Wed, 28 May 2003 08:45:12 -0800
Message-ID: <F001.005A4604.20030528084512@fatcity.com>


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)

, FOREIGN KEY (staff_id) REFERENCES staff(staff_id)
, FOREIGN KEY (proj_id) REFERENCES projects(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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US