You create an optical cluster with the CREATE OPTICAL CLUSTER statement. For information on the syntax, refer to CREATE OPTICAL CLUSTER (+, DB-Access, ESQL/C). As part of the syntax to define the cluster, specify the following column lists:
For example, suppose you are a sporting-goods distributor and you have photographs taken of your stock to include in an electronic catalog. With the Optical Subsystem, you create a table called catalog, which is similar to the catalog table provided with the stores_demo database but which stores the cat_picture column on an optical platter rather than a magnetic disk.
In the CREATE TABLE statement for catalog, you define a BYTE column called cat_picture and use the IN portion of the column definition to place the column in the optical family stock_photos. For the complete syntax of the CREATE TABLE statement, see the IBM Informix: Guide to SQL Syntax.
Next, you decide that you want to keep the photographs for a given manufacturer together to avoid unnecessary platter exchanges during retrieval. To keep photographs for a given manufacturer together, use the CREATE OPTICAL CLUSTER statement and make the manu_code column (also a column in the catalog table) the cluster-key column. Because manu_code contains nine unique values (ANZ, HRO, HSK, KAR, NKL, NRG, PRC, SHM, SMT), the photographs are stored in nine unique clusters, each containing the photographs for a single manufacturer. You assign a cluster size of 18,000 kilobytes to the cluster for the following reason: each photograph requires 60 kilobytes of storage, and you want to allow for as many as 300 photographs per manufacturer.
Insert the first photograph into the database. As the insert operation begins, the Optical Subsystem checks whether the data is stored on an optical platter and whether an optical cluster exists for it. If so, the Optical Subsystem uses an internal optical-cluster table to find the current volume for the cluster-key value. If the cluster-key (manu_code) value for the first insert is HSK, the Optical Subsystem asks the optical-storage subsystem to reserve 18,000 kilobytes on the current volume for this cluster key. This first photograph is then written onto the volume.
The Optical Subsystem adds the cluster-key value, HSK, and the location of the HSK cluster to the cluster-size information that is already recorded in its internal optical-cluster table. The Optical Subsystem also records the fact that 60 kilobytes in the HSK cluster are now used. When the next unique cluster-key value, NRG for example, is inserted, the optical-storage subsystem reserves another 18,000 kilobytes on the current volume for the data associated with this cluster key. This process is repeated each time the optical-storage subsystem encounters a unique cluster-key value.
As HSK and NRG photographs fill their respective clusters, the internal optical-cluster table tracks the amount of space used in each cluster. Before a photograph is written to an optical platter, the Optical Subsystem compares the size of the object with the amount of space that remains in its assigned cluster. If the cluster is too full to receive the photograph, the optical-storage subsystem creates a new cluster on the volume.
If all space on the current volume is filled or reserved, the optical-storage subsystem finds the next available volume in the family (a stand-alone optical-storage subsystem prompts you to mount an empty platter), and creates a new cluster on it for the cluster-key value. When the new cluster is created, the internal optical-cluster table is updated with the new volume number and the new value for space that remains in the current cluster. If an additional volume is not available in the family, an error is returned.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]