带有或不带有索引的批量插入

编程入门 行业动态 更新时间:2024-10-09 13:23:21
本文介绍了带有或不带有索引的批量插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在评论中,我读到

作为旁注,有时删除表的索引并在创建后重新创建它们会更快

Just as a side note, it's sometimes faster to drop the indices of your table and recreate them after the bulk insert operation.

这是真的吗?在什么情况下?

Is this true? Under which circumstances?

推荐答案

与乔尔一样,我将回覆这样的说法:可以。我发现,确定他提到的场景的关键在于数据的分布以及特定表上索引的大小。

As with Joel I will echo the statement that yes it can be true. I've found that the key to identifying the scenario that he mentioned is all in the distribution of data, and the size of the index(es) that you have on the specific table.

在我曾经支持的一个应用程序中,该应用程序进行了180万行的常规批量导入,该表具有4个索引,1个具有11列,表中共有90列。导入索引需要20多个小时才能完成。删除索引,插入和重新创建索引仅花费了1个小时25分钟。

In an application that I used to support that did a regular bulk import of 1.8 million rows, with 4 indexes on the table, 1 with 11 columns, and a total of 90 columns in the table. The import with indexes took over 20 hours to complete. Dropping the indexes, inserting, and re-creating the indexes only took 1 hour and 25 minutes.

所以这可能是一个很大的帮助,但是其中很多问题数据,索引和数据值的分布。

So it can be a big help, but a lot of it comes down to your data, the indexes, and the distribution of data values.

更多推荐

带有或不带有索引的批量插入

本文发布于:2023-10-30 07:34:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1542197.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:批量   或不   索引

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!