tags:

views:

81

answers:

3

Hi, Im reading some Oracle scripts, and I found one with this

Create Table XXY(...)

Tablespace SOME_TABLESPACE
....
NOCOMPRESS
NOPARALLEL
..

What does this mean? What is if for? There are many CreateTable statemsnts, but the Tablespace statement after is exactly the same.

As I understand SOME_TABLESPACE must exist when this script is excecuted, but thats all I could get. Is the purpose of the statement to store all the tables in the same place?

EDIT I read this

http://www.adp-gmbh.ch/ora/concepts/tablespaces.html

+2  A: 

It creates the table in that tablespace. In the case of partitioned tables it defines that tablespace as the default for new partitions and subpartitions also.

David Aldridge
+2  A: 

"Same place" doesn't quite describe it ...

A tablespace is a grouping of common data files. With your "Create" statements you can define in which tablespace an object gets stored. Usually different types of oracle objects are stored in different tablespaces that can have different capabilities.

Some examples:

  • "Data" (your tables and the rows stored in these tables) are stored in a different tablespace than "system information" (such as transaction logs or "caches"). This allows you to store system information on a local drive (quick, but somewhat limited in space) and data in a Storage Area network (basically unlimited space, but not quite as fast).
  • Table Data and Indexes can be stored in different tablespaces which may be on different disks. Therefore, table lookup and index lookup can use different disks and be faster than if both were on the same disk.

Tablespaces and their different characteristics are oen of the many ways of tuning an Oracle DB. Lots of capabilities, lots of complexity. If all you're doing is a little development machine, there is little need to worry about it.

IronGoofy
It's a myth that the separatin of table and index segments improves performance. Tables and indexes are not accessed at the same time by a sinlge query.
David Aldridge
+2  A: 

Please read:

http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm

Pop
I will. Thanks.
Tom