【发布时间】:2010-12-21 15:06:10
【问题描述】:
您好,能否告诉我为什么我们为索引和数据创建不同的表空间。
【问题讨论】:
标签: oracle indexing tablespace
您好,能否告诉我为什么我们为索引和数据创建不同的表空间。
【问题讨论】:
标签: oracle indexing tablespace
人们普遍认为,将索引和表保存在单独的表空间中可以提高性能。这现在被许多受人尊敬的专家认为是一个神话(参见this Ask Tom thread - search for "myth"),但仍然是一种常见的做法,因为旧习惯很难改掉!
从 asktom 中摘录:"Index Tablespace" from 2001 for Oracle version 8.1.6 这个问题
回复的第一部分
Yes, no, maybe.
The idea, born in the 1980s when systems were tiny and user counts were in the single
digits, was that you separated indexes from data into separate tablespaces on different
disks.
In that fashion, you positioned the head of the disk in the index tablespace and the head
of the disk in the data tablespace and that would be better then seeking 2 times on the
same disk.
Drives back then were really slow at seeking and typically measured in the 10's to 100's
of megabytes (if you were lucky)
Today, with logical volumes, raid, NN gigabyte (nn is rapidly becoming NNN gigabytes)
drives, hundreds/thousands of concurrent users, thousands of tables, 10's of thousands of
indexes - this sort of "optimization" is sort of impossible.
What you strive for today is to be able to manage things, to spread IO out evenly
avoiding hot spots.
Since I believe all things should be in locally managed tablespaces with UNIFORM extent
sizes, I would say that yes, indexes would be in a different tablespace from the data but
only because they are a different SIZE then the data. My table with 50 columns and an
average row size of 4k might belong in a tablespace that has 5meg extents whereas the
index on a single number column might belong in a tablespace with 512k or 1m extents.
I tend to keep my indexes separate from the data but for the above sizing reason. The
tablespaces frequently end up on the same exact mount points. You strive for even io
across your disks and you may end up with indexes and data on the same devices.
【讨论】:
foobar_index, foobar_data, foobar_LOB,这些表空间位于顶部:SYSAUX, SYSTEM, TEMP, UNDOTBS1。这么多表空间有缺点吗?
这在 80 年代是有道理的,当时用户并不多,数据库大小也不是太大。那时将索引和表存储在不同的物理卷中很有用。
现在有了逻辑卷、raid等,不需要把索引和表存储在不同的表空间中。
但是所有的表空间都必须在本地使用统一的扩展大小进行管理。从这个角度来看,索引必须存储在不同的表空间中,因为具有 50 列的表可以存储在 5Mb 扩展大小的表空间中,当索引的表空间足够 512Kb 扩展大小时。
【讨论】:
【讨论】: