Skip to content

Commit aa82795

Browse files
author
Dave
authored
DOCS-14995 limit keys for 2dsphere doc indices v5.3 (#613)
* DOCS-14995 too many index keys * Compatibility * Limits * Staging updates * Review feedback * Staging fixes * Review feedback * Review feedback
1 parent c10e9b1 commit aa82795

File tree

6 files changed

+57
-4
lines changed

6 files changed

+57
-4
lines changed

source/core/2dsphere.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ Shard Key Restrictions
101101

102102
.. include:: /includes/geo-data-limit-for-2dsphere.rst
103103

104+
Limited Number of Index Keys
105+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106+
107+
.. include:: /includes/fact-2dsphere-index-limitations.rst
108+
104109
Create a ``2dsphere`` Index
105110
---------------------------
106111

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
To generate keys for a 2dsphere index, :binary:`mongod` maps
2+
:ref:`GeoJSON shapes <geospatial-indexes-store-geojson>` to an internal
3+
representation. The resulting internal representation may be a large
4+
array of values.
5+
6+
When :binary:`mongod` generates index keys on a field that holds an
7+
array, :binary:`mongod` generates an index key for each array element.
8+
For compound indexes, :binary:`mongod` calculates the :term:`cartesian
9+
product` of the sets of keys that are generated for each field. If both
10+
sets are large, then calculating the cartesian product could cause the
11+
operation to exceed memory limits.
12+
13+
:parameter:`indexMaxNumGeneratedKeysPerDocument` limits the maximum
14+
number of keys generated for a single document to prevent out of
15+
memory errors. The default is 100000 index keys per document. It is
16+
possible to raise the limit, but if an operation requires more keys
17+
than the :parameter:`indexMaxNumGeneratedKeysPerDocument` parameter
18+
specifies, the operation will fail.
19+

source/reference/glossary.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ Glossary
127127
For example, the set ``A = { 2, 4, 6 }`` contains 3 elements,
128128
and has a cardinality of 3. See :ref:`shard-key-cardinality`.
129129

130+
cartesian product
131+
The result of combining two data sets such that the combined set
132+
contains every possible combination of values.
133+
130134
checksum
131135
A calculated value used to ensure data integrity.
132136
The :term:`md5` algorithm is sometimes used as a checksum.

source/reference/limits.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ Indexes
208208

209209
The unique indexes limit in :ref:`limits-sharding-operations`.
210210

211+
.. limit:: Limited Number of 2dsphere index keys
212+
213+
.. include:: /includes/fact-2dsphere-index-limitations.rst
214+
211215
.. limit:: NaN values returned from Covered Queries by the WiredTiger Storage Engine are always of type double
212216

213217
If the value of a field returned from a query that is :ref:`covered

source/reference/parameters.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,9 +1421,19 @@ General Parameters
14211421

14221422
mongod --setParameter disableJavaScriptJIT=false
14231423

1424-
.. parameter:: maxIndexBuildMemoryUsageMegabytes
1424+
.. parameter:: indexMaxNumGeneratedKeysPerDocument
14251425

1426-
.. versionadded:: 3.4
1426+
.. versionadded:: 5.3
1427+
1428+
*Default*: 100000
1429+
1430+
Limits the maximum number of keys generated for a document to
1431+
prevent out of memory errors. It is possible to raise the limit, but
1432+
if an operation requires more keys than the
1433+
:parameter:`indexMaxNumGeneratedKeysPerDocument` parameter specifies,
1434+
the operation will fail.
1435+
1436+
.. parameter:: maxIndexBuildMemoryUsageMegabytes
14271437

14281438
*Default*:
14291439

source/release-notes/5.3-compatibility.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,16 @@ Time Series Collections
2222
If there are :term:`secondary indexes <secondary index>` on :ref:`time
2323
series collections <manual-timeseries-collection>` and you need to
2424
downgrade the Feature Compatibility Version (FCV), you must first drop
25-
any secondary indexes that are incompatible with the downgraded FCV. See
26-
:ref:`timeseries-limitations-secondary-indexes`.
25+
any secondary indexes that are incompatible with the downgraded FCV.
26+
See :ref:`timeseries-limitations-secondary-indexes`.
27+
28+
2dsphere Document Index Keys
29+
----------------------------
30+
31+
To prevent out of memory errors,
32+
:parameter:`indexMaxNumGeneratedKeysPerDocument` limits the maximum
33+
number of :ref:`2dsphere index keys <geo-2dsphere>` generated for a
34+
single document.
35+
36+
See :parameter:`indexMaxNumGeneratedKeysPerDocument`.
37+

0 commit comments

Comments
 (0)