Skip to content

Commit 0fcd460

Browse files
authored
Merge pull request #284064 from seesharprun/cosmos-ttl
Cosmos DB | Improve Acrolinx score in TTL article
2 parents ae1b8f7 + 1cd42d2 commit 0fcd460

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

articles/cosmos-db/nosql/time-to-live.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ ms.reviewer: mjbrown
77
ms.service: azure-cosmos-db
88
ms.subservice: nosql
99
ms.topic: conceptual
10-
ms.date: 11/03/2023
10+
ms.date: 08/08/2024
1111
---
12+
1213
# Time to Live (TTL) in Azure Cosmos DB
14+
1315
[!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
1416

15-
With **Time to Live** or TTL, Azure Cosmos DB deletes items automatically from a container after a certain time period. By default, you can set time to live at the container level and override the value on a per-item basis. After you set the TTL at a container or at an item level, Azure Cosmos DB will automatically remove these items after the time period, since the time they were last modified. Time to live value is configured in seconds. When you configure TTL, the system automatically deletes the expired items based on the TTL value, without needing a delete operation explicitly issued by the client application. The maximum value for TTL is 2147483647 seconds, the approximate equivalent of 24,855 days or 68 years.
17+
With **Time to Live** or TTL, Azure Cosmos DB deletes items automatically from a container after a certain time period. By default, you can set time to live at the container level and override the value on a per-item basis. After you set the TTL at a container or at an item level, Azure Cosmos DB will automatically remove these items after the time period, since the time they were last modified. Time to live value is configured in seconds. When you configure TTL, the system automatically deletes the expired items based on the TTL value, without needing a delete operation explicitly issued by the client application. The maximum value for TTL is 2,147,483,647 seconds, the approximate equivalent of 24,855 days or 68 years.
1618

17-
Deletion of expired items is a background task that consumes left-over [Request Units](../request-units.md) that haven't been consumed by user requests. Even after the TTL expires, if the container is overloaded with requests and if there aren't enough RUs available, the data deletion is delayed. Data is deleted once there are enough RUs available to perform the delete operation. Though the data deletion is delayed, data isn't returned by any queries (by any API) after the TTL expires.
19+
Deletion of expired items is a background task that consumes left-over [Request Units](../request-units.md) that haven't been consumed by user requests. Even after the TTL expires, if the container is overloaded with requests and if there aren't enough request units (RUs) available, the data deletion is delayed. Data is deleted once there are enough RUs available to perform the delete operation. Though the data deletion is delayed, data isn't returned by any queries (by any API) after the TTL expires.
1820

1921
> [!NOTE]
2022
> This content is related to Azure Cosmos DB transactional store TTL. If you are looking for analytical store TTL, that enables NoETL HTAP scenarios through [Azure Synapse Link](../synapse-link.md), please click [here](../analytical-store-introduction.md#analytical-ttl).
@@ -27,9 +29,9 @@ The time to live value is set in seconds, and is interpreted as a delta from the
2729

2830
- If missing (or set to null), items aren't expired automatically.
2931

30-
- If present and the value is set to "-1", it's equal to infinity, and items don’t expire by default.
32+
- If present and the value is set to *"-1,"* it's equal to infinity, and items don’t expire by default.
3133

32-
- If present and the value is set to some *nonzero* number *"n"* items will expire *"n"* seconds after their last modified time.
34+
- If present and the value is set to some *nonzero* number *"n,"* items will expire *"n"* seconds after their last modified time.
3335

3436
2. **Time to Live on an item** (set using `ttl`):
3537

@@ -58,29 +60,29 @@ TTL on container is set to null (DefaultTimeToLive = null)
5860

5961
|TTL on item| Result|
6062
|---|---|
61-
|ttl property missing |TTL is disabled. The item will never expire (default).|
62-
|ttl = -1|TTL is disabled. The item will never expire.|
63-
|ttl = 2000|TTL is disabled. The item will never expire.|
63+
|ttl property missing |TTL is disabled. The item never expires (default).|
64+
|ttl = -1|TTL is disabled. The item never expires.|
65+
|ttl = 2000|TTL is disabled. The item never expires.|
6466

6567
### Example 2
6668

6769
TTL on container is set to -1 (DefaultTimeToLive = -1)
6870

6971
|TTL on item| Result|
7072
|---|---|
71-
|ttl property missing |TTL is enabled. The item will never expire (default).|
72-
|ttl = -1|TTL is enabled. The item will never expire.|
73-
|ttl = 2000|TTL is enabled. The item will expire after 2000 seconds.|
73+
|ttl property missing |TTL is enabled. The item never expires (default).|
74+
|ttl = -1|TTL is enabled. The item never expires.|
75+
|ttl = 2000|TTL is enabled. The item expires after 2,000 seconds.|
7476

7577
### Example 3
7678

7779
TTL on container is set to 1000 (DefaultTimeToLive = 1000)
7880

7981
|TTL on item| Result|
8082
|---|---|
81-
|ttl property missing |TTL is enabled. The item will expire after 1000 seconds (default).|
83+
|ttl property missing |TTL is enabled. The item will expire after 1,000 seconds (default).|
8284
|ttl = -1|TTL is enabled. The item will never expire.|
83-
|ttl = 2000|TTL is enabled. The item will expire after 2000 seconds.|
85+
|ttl = 2000|TTL is enabled. The item will expire after 2,000 seconds.|
8486

8587
## Next steps
8688

0 commit comments

Comments
 (0)