Skip to content

Commit c7dd2c2

Browse files
authored
DOCSP 24995 documenting performance degradation of bulk inserts (#5141) (#5287)
* DOCSP-24995 documenting performance degredation of bulk random insert * DOCSP-24995 small wording changes * DOCSP-24995 small wording changes * DOCSP-24995 small wording changes * DOCSP-24995 small wording changes * DOCSP-24995 rephrase * DOCSP-24995 rephrase * DOCSP-24995 copy edits * DOCSP-24995 copy edits * DOCSP-24995 copy edits * DOCSP-24995 copy edits * DOCSP-24995 copy edits * DOCSP-24995 tech edit
1 parent ce9ac67 commit c7dd2c2

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

source/faq/indexes.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,8 @@ Write operations may require updates to indexes:
116116

117117
Therefore, if your application is write-heavy, indexes might affect
118118
performance.
119+
120+
How does random data impact index performance?
121+
----------------------------------------------
122+
123+
.. include:: /includes/indexes/random-data-performance.rst
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
If an operation inserts a large amount of random data (for example,
2+
hashed indexes) on an indexed field, insert performance may decrease.
3+
Bulk inserts of random data create random index entries, which increase
4+
the size of the index. If the index reaches the size that requires each
5+
random insert to access a different index entry, the inserts result in a
6+
high rate of WiredTiger cache eviction and replacement. When this
7+
happens, the index is no longer fully in cache and is updated on disk,
8+
which decreases performance.
9+
10+
To improve the performance of bulk inserts of random data on indexed
11+
fields, you can either:
12+
13+
- Drop the index, then recreate it after you insert the random data.
14+
- Insert the data into an empty unindexed collection.
15+
16+
Creating the index after the bulk insert sorts the data in memory and
17+
performs an ordered insert on all indexes.

source/reference/method/Bulk.insert.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ Insert Inaccuracies
4949

5050
.. |writeResult| replace:: :data:`BulkWriteResult.nInserted`
5151

52+
Performance Consideration for Random Data
53+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54+
55+
.. include:: /includes/indexes/random-data-performance.rst
56+
5257
Example
5358
-------
5459

source/reference/method/db.collection.insertMany.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ Write Concerns and Transactions
178178

179179
.. |operation| replace:: :method:`db.collection.insertMany()`
180180

181+
Performance Consideration for Random Data
182+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
183+
184+
.. include:: /includes/indexes/random-data-performance.rst
181185

182186
.. _insertMany-examples:
183187

0 commit comments

Comments
 (0)