索引有不同的表空间有什么逻辑原因吗?

发布于 2024-08-13 03:44:07 字数 38 浏览 1 评论 0原文

您好,有人可以告诉我为什么我们为索引和数据创建不同的表空间吗?

Hi Can some let me know why we created different table space for Index and data.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

稳稳的幸福 2024-08-20 03:44:07

人们普遍认为,将索引和表保存在单独的表空间中可以提高性能。现在,许多受人尊敬的专家认为这是一个神话(请参阅 此询问汤姆主题 - 搜索“神话”),但这仍然是一种常见做法,因为旧习难改!

第三方编辑

来自asktom的摘录: “索引表空间” 从 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. 

It is a widespread belief that keeping indexes and tables in separate tablespaces improves performance. This is now considered a myth by many respectable experts (see this Ask Tom thread - search for "myth"), but is still a common practice because old habits die hard!

Third party edit

Extract from asktom: "Index Tablespace" from 2001 for Oracle version 8.1.6 the question

  • Is it still a good idea to keep indexes in their own tablespace?
  • Does this inhance performance or is it more of a recovery issue?
  • Does the answer differ from one platform to another?

First part of the Reply

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. 
妄断弥空 2024-08-20 03:44:07

这在 80 年代是有意义的,当时用户不多,数据库大小也不是太大。当时,将索引和表存储在不同的物理卷中非常有用。

现在有了逻辑卷、raid等,不需要将索引和表存储在不同的表空间中。

但所有表空间必须以统一的扩展大小进行本地管理。从这个角度来看,索引必须存储在不同的表空间中,因为当索引的表空间有足够的 512Kb 扩展大小时,具有 50 列的表可以存储在 5Mb 扩展大小的表空间中。

It makes a sense in 80s, when there were not to many users and the databases size was not too big. At that time it was usefull to store indexes and tables in the different physical volumes.

Now there are the logical volumes, raid and so on and it is not necessary to store the indexes and tables in different tablespaces.

But all tablespaces must be locally managed with uniform extends size. From this point of view the indexes must be stored in different tablespace as the table with the 50 columns could be stored in the tablespace with 5Mb exteds size, when the tablespace for indexes will be enought 512Kb extended size.

哭了丶谁疼 2024-08-20 03:44:07
  • 表现。应该具体情况具体分析。我认为将所有内容放在一个表空间中也成为另一个神话!它应该有足够的心轴、足够的 lun 并负责操作系统中的排队。如果有人认为创建一个表空间就足够了,并且与许多表空间一样,而不考虑所有其他因素,这又意味着另一个神话。这取决于!
  • 高可用性。使用单独的表空间可以提高系统的高可用性,以防某些文件损坏、文件系统损坏、块损坏。如果问题仅发生在索引表空间上,则有机会进行在线恢复,并且我们的应用程序仍然可供客户使用。另请参阅: http://richardfoote.wordpress.com/2008/05/02/indexes-in-their-own-tablespace-recoverability-advantages-get-back/
  • 对索引、数据、blob、clob 使用单独的表空间,最终,一些单独的表对于可管理性和成本可能很重要。我们可以使用我们的存储系统来存储我们的 blob、clob,最终归档到具有不同服务质量的不同存储层
  • Performance. It should be analyzed from case to case. I think that keeping all together in one tablespace becomes another myth too! It should be enough spindles, enough luns and take care of queuing in the operating system. if someone thinks that making one tablespace is enough and is the same like many tablespaces without taking in consideration all other factors, means again another myth. It depends!
  • High Availability. using separate tablespaces can improve high availability of the system in case that some file corruption, file system corruption, block corruption. If the problem occurs only at index tablespace there is a chance to do the recovery online and our application still being available to the customer. see also: http://richardfoote.wordpress.com/2008/05/02/indexes-in-their-own-tablespace-recoverability-advantages-get-back/
  • using separate tablespaces for indexes, data, blobs, clobs, eventually some individual tables can be important for the manageability and costs. We can use our storage system to store our blobs, clobs, eventually archive to a different layer of storage with different quality of service
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文