Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

Table Option (REUSE_OID)

Description

You can specify the REUSE_OID option when creating a table, so that OIDs that have been deleted due to the deletion of records (DELETE) can be reused when a new record is inserted (INSERT). Such a table is called an OID reusable or a non-referable table.

OID (Object Identifier) is an object identifier represented by physical location information such as the volume number, page number and slot number. By using such OIDs, CUBRID manages the reference relationships of objects and searches, saves or deletes them. When an OID is used, accessibility is improved because the object in the heap file can be directly accessed without referring to the table. However, the problem of decreased reusability of the storage occurs when there are many DELETE/ INSERT operations because the object's OID is kept to maintain the reference relationship with the object even if it is deleted.

If you specify the REUSE_OID option when creating a table, the OID is also deleted when data in the table is deleted, so that another INSERTed data can use it. OID reusable tables cannot be referred to by other tables, and OID values of the objects in the OID reusable tables cannot be viewed.

Example

--creating table with REUSE_OID option specified

CREATE TABLE reuse_tbl (a INT PRIMARY KEY) REUSE_OID;

INSERT INTO reuse_tbl VALUES (1);

INSERT INTO reuse_tbl VALUES (2);

INSERT INTO reuse_tbl VALUES (3);

;xr

 

3 rows affected.

 

--an error occurs when column type is a OID reusable table itself

CREATE TABLE tbl_1 ( a reuse_tbl);

;xr

 

In line 1, column 34,

 

ERROR: The class 'reuse_tbl' is marked as REUSE_OID and is non-referable. Non-referable classes can't be the domain of an attribute and their instances' OIDs cannot be returned.

 

--an error occurs when a table references a OID reusable table

CREATE TABLE tbl_2

(b int, FOREIGN KEY(b) REFERENCES reuse_tbl(a) ON CACHE OBJECT oid_value);

INSERT INTO tbl_2(b) VALUES(1);

SELECT oid_value.a FROM tbl_2;

;xr

 

ERROR: The class 'reuse_tbl' is marked as REUSE_OID and is non-referable. Non-referable classes can't be the domain of an attribute and their instances' OIDs cannot be returned.

Caution
  • OID reusable tables cannot be referred to by other tables.
  • Updatable views cannot be created for OID reusable tables.
  • OID reusable tables cannot be specified as class attribute domains of other tables.
  • OID values of the objects in the OID reusable tables cannot be read.
  • Instance methods cannot be called from OID reusable tables. Also, instance methods cannot be called if a subclass inherited from the class where the method is defined is defined as an OID reusable table.
  • OID reusable tables are supported only by CUBRID 2008 R2.2 or above, and backward compatibility is not ensured. That is, the database in which the OID reusable table is located cannot be accessed from a lower version database.
  • OID reusable tables can be managed as partitioned tables and can be replicated.