Data Structures   «Prev  Next»
Lesson 7

Tuning with Oracle Data Structures Conclusion

This module explored the performance implications of object-oriented features that were introduced in Oracle beginning with Oracle 8i.
This module explored the performance implications of the exciting new object-oriented features introduced in Oracle. The main points of this module include:
  1. Abstract data type (ADT) is great for grouping related data columns together and reusing them in many Oracle tables.
  2. Oracle allows for OIDs to be datatypes. You can create a column in a table that contains the OIDs of other tables.
  3. Getting data from other tables is achieved by de-referencing the OID. This uses the DEREF syntax.
  4. The DEREF command displays the contents of the row that corresponds with the OID.
  5. De-referencing an OID is far faster than joining tables together, and requires less disk I/O and fewer block reads.
  6. Because Oracle uses the term OID to mean an Object ID, or the Oracle Internet Directory, be careful when reading the Oracle documentation.
Oracle allows for the definition of repeating data types. These data types can be inserted into tables, avoiding the need to join tables together.

Object Layer

Rather than rebuild the Oracle engine as an object-oriented architecture, Oracle has decided to keep the base relational engine and add object functionality on top of the standard relational architecture. While claiming to be an active member in the Object Management Group (OMG), Oracle has departed from the OMG's standard for "pure" object databases as defined by the Object Data Management Group. Oracle's intent is to provide a generic relational database while extending the architecture to allow for objects. The object layer of Oracle offers the following features:
  1. abstract data typing,
  2. definition of aggregate objects,
  3. coupling of data and behavior,
  4. abstraction,
  5. inheritance,
  6. polymorphism,
  7. encapsulation, and
  8. extensibility.

The main points of this module include:
  1. You can now define your own data types and define columns that participate in these data types.
  2. Some of the new object-oriented Oracle features include ADTs, OIDs, nested tables,
  3. Oracle now provides for nested tables, where a column can point to a number a row of a subordinate table.
  4. Oracle now has Object IDs (OIDs). These uniquely identify Oracle rows, and they will never change, even if the row is relocated.

Object Tables and OIDs

In an object table, each row is a row object. An object table differs from a normal relational table in several ways.
  1. First, each row within the object table has an OID, an object identifier value assigned by Oracle when the row is created.
  2. Second, the rows of an object table can be referenced by other objects within the database.

You can create an object table via the create table command. Consider the ANIMAL_TY datatype shown in previous chapters. To avoid conflicts with objects created during earlier chapters, create this type in a new schema:
create or replace type ANIMAL_TY as object
(Breed VARCHAR2(25),
Name VARCHAR2(25),
BirthDate DATE);

To keep this example simple, the ANIMAL_TY datatype is created without any member functions. To create an object table of the ANIMAL_TY datatype, issue the following create table command:
create table ANIMAL of ANIMAL_TY;
Table created.

Note that the command has an unusual syntax, creating the table of an object type. The resulting table may first appear to be a normal relational table:
describe ANIMAL
Name 		        			Type
------------------------------- --------------------
BREED 					       VARCHAR2(25)
NAME 					       VARCHAR2(25)
BIRTHDATE 				       DATE

The ANIMAL table's columns map to the attributes of the ANIMAL_TY object type. However, there are significant differences in how you can use the table, since it is an object table. As noted earlier in this section, each row within the object table will have an OID value, and the rows can be referenced as objects.

Glossary Terms

Here are some terms that may be new to you:
  1. Object ID:A unique identifier for an object.
  2. Pointer: A variable or reference that holds address information and points or refers to a location (usually in another table).
  3. VARRAY:Is a repeating group that allows us to dramatically improve the performance of Oracle queries, because subordinate tables are no longer required in order to represent a one-to-many relationship.
The next module discusses using the Oracle Dictionary to monitor performance.

Object Data Constructs - Quiz

Before moving on to the next module, click the Quiz link below to test your understanding of tuning with data structures.
Object Data Constructs - Quiz