|
1 | 1 | ---
|
2 | 2 | title: Delete data from Azure Data Explorer
|
3 |
| -description: This article describes bulk delete scenarios in Azure Data Explore, including purge and retention based deletes. |
| 3 | +description: This article describes delete scenarios in Azure Data Explorer, including purge, dropping extents and retention based deletes. |
4 | 4 | author: orspod
|
5 | 5 | ms.author: orspodek
|
6 |
| -ms.reviewer: mblythe |
| 6 | +ms.reviewer: avneraa |
7 | 7 | ms.service: data-explorer
|
8 | 8 | ms.topic: conceptual
|
9 |
| -ms.date: 09/24/2018 |
| 9 | +ms.date: 03/12/2020 |
10 | 10 | ---
|
11 | 11 |
|
12 | 12 | # Delete data from Azure Data Explorer
|
13 | 13 |
|
14 |
| -Azure Data Explorer supports several bulk delete approaches, which we cover in this article. It doesn't support per-record deletion in real time, because it's optimized for fast read access. |
| 14 | +Azure Data Explorer supports various delete scenarios described in this article. |
15 | 15 |
|
16 |
| -* If one or more tables is no longer needed, delete them using the drop table or drop tables command. |
| 16 | +## Delete data using the retention policy |
17 | 17 |
|
18 |
| - ```Kusto |
19 |
| - .drop table <TableName> |
| 18 | +Azure Data Explorer automatically deletes data based on the [retention policy](/azure/kusto/management/retentionpolicy). This method is the most efficient and hassle-free way of deleting data. Set the retention policy at the database or table level. |
20 | 19 |
|
21 |
| - .drop tables (<TableName1>, <TableName2>,...) |
22 |
| - ``` |
| 20 | +Consider a database or table that is set for 90 days of retention. If only 60 days of data are needed, delete the older data as follows: |
| 21 | + |
| 22 | +```kusto |
| 23 | +.alter-merge database <DatabaseName> policy retention softdelete = 60d |
| 24 | +
|
| 25 | +.alter-merge table <TableName> policy retention softdelete = 60d |
| 26 | +``` |
| 27 | + |
| 28 | +## Delete data by dropping extents |
| 29 | + |
| 30 | +[Extent (data shard)](/azure/kusto/management/extents-overview) is the internal structure where data is stored. Each extent can hold up to millions of records. Extents can be deleted individually or as a group using [drop extent(s) commands](/azure/kusto/management/extents-commands#drop-extents). |
23 | 31 |
|
24 |
| -* If old data is no longer needed, delete it by changing the retention period at the database or table level. |
| 32 | +### Examples |
25 | 33 |
|
26 |
| - Consider a database or table that is set for 90 days of retention. Business needs change, so now only 60 days of data is needed. In this case, delete the older data in one of the following ways. |
| 34 | +You can delete all rows in a table or just a specific extent. |
27 | 35 |
|
28 |
| - ```Kusto |
29 |
| - .alter-merge database <DatabaseName> policy retention softdelete = 60d |
| 36 | +* Delete all rows in a table: |
30 | 37 |
|
31 |
| - .alter-merge table <TableName> policy retention softdelete = 60d |
| 38 | + ```kusto |
| 39 | + .drop extents from TestTable |
32 | 40 | ```
|
33 | 41 |
|
34 |
| - For more information, see [Retention policy](https://docs.microsoft.com/azure/kusto/concepts/retentionpolicy). |
| 42 | +* Delete a specific extent: |
| 43 | +
|
| 44 | + ```kusto |
| 45 | + .drop extent e9fac0d2-b6d5-4ce3-bdb4-dea052d13b42 |
| 46 | + ``` |
| 47 | +
|
| 48 | +## Delete individual rows using purge |
| 49 | +
|
| 50 | +[Data purge](/azure/kusto/management/data-purge) can be used for deleting individuals rows. Deletion isn't immediate and requires significant system resources. As such, it's only advised for compliance scenarios. |
35 | 51 |
|
36 |
| -If you need assistance with data deletion issues, please open a support request in the [Azure portal](https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview). |
|
0 commit comments