Skip to content

Commit f808857

Browse files
authored
DOCSP 24995 documenting performance degradation of bulk inserts (#5141)
* 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 a55f624 commit f808857

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
@@ -118,3 +118,8 @@ Write operations may require updates to indexes:
118118

119119
Therefore, if your application is write-heavy, indexes might affect
120120
performance.
121+
122+
How does random data impact index performance?
123+
----------------------------------------------
124+
125+
.. 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.insertedCount`
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
@@ -181,6 +181,10 @@ Write Concerns and Transactions
181181

182182
.. |operation| replace:: :method:`db.collection.insertMany()`
183183

184+
Performance Consideration for Random Data
185+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186+
187+
.. include:: /includes/indexes/random-data-performance.rst
184188

185189
.. _insertMany-examples:
186190

0 commit comments

Comments
 (0)