Explain types of tables in oracle

来源:互联网 发布:centos 安装bugzilla 编辑:程序博客网 时间:2024/05/29 05:56

In Oracle, tables are the basic storage units. There are several types of database tables. Different types of tables have different characteristics.

Heap Organized Table:

The default table type in Oracle is heap table. If you use “create table” clause normally, you create a standard database table. Exp:

create table A
(
x char
);

Object Table

This type of table is created based on an object type and not collection of columns. It is usually used in special cases. The logic depends on object-oriented programming. “create table ” statement for object tables is:

create table test of x_type;

create or replace type atype
as object
(
a varchar2(30),
b date
)

Create table p of atype;

Index Organized Tables

Index Organized Tables have their primary key and non-key column data stored within the same B-Tree structure.

The data is stored within the primary key index.

Use:

IOTs make accessing data via the primary key quicker as the key and the data reside in the same structure.
Since there is no need to read an index, the table data is read in a separate structure.
Less duplication of the key columns in an index and table mean low storage requirements.

Hash clustered tables

Hash clusters provide a good facility for storage and retrieval.

In the case of a heap table, the rows are not sorted in a user-controlled manner.

Oracle hash cluster tables can improve random row access speed by foour times as the hash can get the row location far faster than index access.

Multiple table hash clusters store logically-related rows on a single data block due to which you can access a whole unit of data in a single physical I/O.

Nested tables

Nested table can be used to link the subordinate data items to the base table using the object ID (OID).

Oracle objects can be directly referenced by using pointers as opposed joining relational.

Objects in standard relational databases need to be reassembled every time it is used.

Index cluster tables

An index cluster uses an index to maintain row sequence.

A table cluster is a group of tables that share the same data blocks, since they share common columns and are often used together.

All rows for each table are stored in the same data blocks, When you create cluster tables are created.

The cluster key value is the value of the cluster key columns for a particular row.

Index cluster tables can be either multi-table or single-table