oracle 有没有什么逻辑上的原因,有不同的索引索引?

r9f1avp5  于 2023-10-16  发布在  Oracle
关注(0)|答案(3)|浏览(107)

你好,可以让我知道为什么我们为索引和数据创建不同的表空间。

wpcxdonn

wpcxdonn1#

人们普遍认为,将索引和表保持在单独的表空间中可以提高性能。现在这被许多受人尊敬的Maven认为是一个神话(见this Ask Tom thread - search for "myth"),但仍然是一个普遍的做法,因为旧习难改!

第三方编辑

摘自asktom:"Index Tablespace"从2001年的Oracle版本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.
ukxgm1gy

ukxgm1gy2#

这在80年代是有意义的,当时没有太多的用户,数据库的大小也不是太大。当时,将索引和表存储在不同的物理卷中是有用的。
现在有了逻辑卷、raid等,没有必要将索引和表存储在不同的表空间中。
但是所有的表空间都必须以统一的extends大小进行本地管理。从这个Angular 来看,索引必须存储在不同的磁盘中,因为具有50列的表可以存储在具有5Mb扩展大小的磁盘中,而索引的磁盘将具有足够的512Kb扩展大小。

mklgxw1f

mklgxw1f3#

  • 性能应该从个案中分析。我想,把所有的东西放在一起也成了另一个神话!它应该有足够的磁盘轴,足够的LUN,并负责操作系统中的排队。如果有人认为创建一个表空间就足够了,就像许多表空间一样,而不考虑所有其他因素,这又意味着另一个神话。看情况了!
  • 高可用性。使用单独的表空间可以在某些文件损坏、文件系统损坏、块损坏的情况下提高系统的高可用性。如果问题只发生在索引目录中,则有机会在线进行恢复,并且客户仍然可以使用我们的应用程序。标签:http://richardfoote.wordpress.com/2008/05/02/indexes-in-their-own-tablespace-recoverability-advantages-get-back/
  • 对索引、数据、blob、clob使用单独的表空间,最终某些单独的表可能对开销和成本很重要。我们可以使用存储系统存储blob、clob,最终归档到具有不同服务质量的不同存储层

相关问题