Table Types Heap Type Ordinary heaporganized table Partitioned
Table Types Heap • Type • Ordinary (heaporganized) table • Partitioned table Clustered • Description • Data is stored as an unordered collection (heap). • Data is divided into smaller, more manageable pieces. • Index-organized table • Data (including non-key values) is sorted and stored in a B-tree index structure. (IOT) • Related data from more than one table • Clustered table are stored together. Partitioned IOT
What Is a Partition and Why Use It? • A partition is: – A piece of a “very large” table or index – Stored in its own segment – Used for improved performance and manageability
Index-Organized Tables • Regular table access IOT access Table access by ROWID Non-key columns Key column Row header
Index-Organized Tables and Heap Tables – – Compared to heap tables, IOTs: • Have faster key-based access to table data • Do not duplicate the storage of primary key values • Require less storage • Use secondary indexes and logical row IDs • Have higher availability because table reorganization does not invalidate secondary indexes IOTs have the following restrictions: • Must have a primary key that is not DEFERRABLE • • • Cannot be clustered Cannot use composite partitioning Cannot contain a column of type ROWID or LONG
Clusters ----- ORD_NO QTY ----- PROD. . . ------ 101 20 102 11 102 20 102 26 101 19 101 10 A 4102 - A 2091 G 7830 N 9587 A 5675 ORD_NO W 0824 -----101 102 ORD_DT -----05 -JAN-97 07 -JAN-97 Cluster Key (ORD_NO) 101 ORD_DT CUST_CD 05 -JAN-97 R 01 PROD QTY A 4102 20 A 5675 19 W 0824 10 CUST_CD 102 ORD_DT CUST_CD -----07 -JAN-97 N 45 R 01 PROD N 45 QTY A 2091 11 G 7830 20 N 9587 Unclustered orders and order_item tables 26 Clustered orders and order_item tables
Cluster Types Index cluster Hash function
Situations Where Clusters Are Useful Criterion Index Hash Uniform key distribution X X Evenly spread key values X Rarely updated key X Often joined master-detail tables X X Predictable number of key values X Queries using equality predicate on key X
- Slides: 7