ORACLE在索引表上插入性能 [英] ORACLE Insert performance on indexed tables

查看:280
本文介绍了ORACLE在索引表上插入性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Insert语句在索引表上执行速度较慢?

Why Insert statements perform slower on a indexed table?

推荐答案

这实际上是同样的问题: p>

This is actually the same kind of question as:


为什么需要更多的时间将我所有的杂货放在我的厨房里正确的地方
,访问我的杂货店?

Why does it take more time to put all my groceries in the correct place in my kitchen than leaving everything in the bags after I visited my groceries store?

这是因为在储存你的杂货时,你想要他们在一个漂亮,众所周知的位置,更容易找到它们。

This is because when storing your groceries, you want them on a nice, well known position so that it is easier to find them afterwards.

数据库也必须这样做。


  • 如果您有一个没有索引的表,它只能在表的末尾添加新数据。

  • 如果您有索引,数据库必须执行更多的工作。它可能仍然将记录放在表的末尾,但另外它会更新其索引,以确保如果您想要找到该记录后,它会找到比没有索引更快。

这也意味着添加更多索引会进一步减慢插入。

This also means that adding more indexes will further slow down inserts.

你只想创建一个索引,如果你也将使用它之后。如果你只创建一个索引,并且你以后不使用它来提高查询的性能,没有必要有索引,因为它只会减慢插入,而不是提高任何查询。

It should be clear that you only want to create an index if you will also use it afterwards. If you only create an index and you are not using it afterwards to improve the performance of a query, there's no need to have the index as it will only slow down the inserts, and not improve any query.

这篇关于ORACLE在索引表上插入性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆