Skip to content

Commit c034721

Browse files
authored
DOCSP-39913 Add TTL Index Behavior Content (#7853) (#7884)
* DOCSP-39913 Add TTL Index Behavior Content * * * * * * * * * * * * * * * TR
1 parent 7bfc8cb commit c034721

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

source/core/index-ttl.txt

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,39 @@ collection:
126126
}
127127
})
128128

129+
.. important::
130+
131+
Consider the following before updating the ``expireAfterSeconds``
132+
parameter of a TTL index:
133+
134+
- Changing the ``expireAfterSeconds`` parameter **does not** trigger a
135+
complete index rebuild. However, reducing the ``expireAfterSeconds``
136+
value can make many documents eligible for immediate deletion,
137+
potentially causing performance issues due to the increased delete
138+
operations.
139+
140+
- The recommended approach is to manually delete documents in
141+
small batches before updating the TTL index. This helps control
142+
the impact on your cluster.
143+
144+
- Deleting many documents can fragment storage files, additionally
145+
impacting performance. You may need to run the
146+
:ref:`compact <compact>` command on your collection or
147+
perform a :ref:`replica-set-initial-sync` to reclaim space and
148+
optimize storage.
149+
129150
Behavior
130151
--------
131152

132153
Expiration of Data
133154
~~~~~~~~~~~~~~~~~~
134155

135156
TTL indexes expire documents after the specified number of seconds has
136-
passed since the indexed field value; i.e. the expiration threshold is
137-
the indexed field value plus the specified number of seconds.
157+
passed since the indexed field value. The expiration threshold is
158+
the indexed field value plus the specified number of seconds.
138159

139160
If the field is an array, and there are multiple date values in the
140-
index, MongoDB uses *lowest* (i.e. earliest) date value in the array to
161+
index, MongoDB uses *lowest* (earliest) date value in the array to
141162
calculate the expiration threshold.
142163

143164
If the indexed field in a document is not a

0 commit comments

Comments
 (0)