Changing the Oracle Surrounding

Clusters
Clustering is a method of storing tables that are intimately related and often joined together into the same area on disk. For example, instead of the worker table being in one section of the disk and the workerskill table being somewhere else, their rows could be interleaved together in a single area, called a cluster. To cluster tables, you must own the tables you are going to cluster together. Syntax of CREATE CLUSTER command is:

CREATE CLUSTER cluster (Column datatype [, Column datatype] . . . ) [OTHER OPTIONS];

Example,

SQL> CREATE CLUSTER Worker_Skill (Judy VARCHAR2(25));
Cluster created.

Next, the first tables is created to be included in this cluster:

SQL> CREATE TABLE worker (
Name VARCHAR2(25) NOT NULL,
Age NUMBER,
Lodging VARCHAR2(15)
)
CLUSTER Worker_Skill (Name);

Name is the column in this table that will be stored in the cluster key Judy.

Note: Prior to inserting rows into worker, you must create a cluster index:

SQL> CREATE INDEX Worker_Skill_NDX ON CLUSTER Worker_Skill ;

Now a second table is added to the cluster:

SQL> CREATE TABLE workerskill (
Name VARCHAR2(25) NOT NULL,
Skill VARCHAR2(25) NOT NULL,
Ability VARCHAR2(15)
)
CLUSTER Worker_Skill (Name);