|
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 using retention policy |
| 17 | + |
| 18 | +Azure Data Explorer automatically deletes data based on the [retention policy](/azure/kusto/management/retentionpolicy). This is the most efficient and hassle-free method of deleting data. Set the retention policy at the database or table level. |
| 19 | + |
| 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: |
17 | 21 |
|
18 | 22 | ```Kusto
|
19 |
| - .drop table <TableName> |
| 23 | + .alter-merge database <DatabaseName> policy retention softdelete = 60d |
20 | 24 |
|
21 |
| - .drop tables (<TableName1>, <TableName2>,...) |
| 25 | + .alter-merge table <TableName> policy retention softdelete = 60d |
22 | 26 | ```
|
23 | 27 |
|
24 |
| -* If old data is no longer needed, delete it by changing the retention period at the database or table level. |
| 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). |
| 31 | + |
| 32 | +### Examples |
| 33 | + |
| 34 | +You can delete all rows in a table or just a specific extent. |
25 | 35 |
|
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. |
| 36 | +* Delete all rows in a table: |
27 | 37 |
|
28 | 38 | ```Kusto
|
29 |
| - .alter-merge database <DatabaseName> policy retention softdelete = 60d |
| 39 | + .drop extents from TestTable |
| 40 | + ``` |
30 | 41 |
|
31 |
| - .alter-merge table <TableName> policy retention softdelete = 60d |
| 42 | +* Delete a specific extent: |
| 43 | +
|
| 44 | + ```Kusto |
| 45 | + .drop extent e9fac0d2-b6d5-4ce3-bdb4-dea052d13b42 |
32 | 46 | ```
|
33 | 47 |
|
34 |
| - For more information, see [Retention policy](https://docs.microsoft.com/azure/kusto/concepts/retentionpolicy). |
| 48 | +## Delete individual rows using purge |
| 49 | +
|
| 50 | +> [!NOTE] |
| 51 | +> Purge allows you to delete personal data from the device or service and can be used to support your obligations under the GDPR. If you're looking for general information about GDPR, see the [GDPR section of the Service Trust portal](https://servicetrust.microsoft.com/ViewPage/GDPRGetStarted). |
| 52 | +
|
| 53 | +[Data purge](/azure/kusto/management/data-purge) can be used for deleting individuals rows. Deletion is *not* immediate and requires significant system resources. Therefore, it is only advised for compliance scenarios. |
35 | 54 |
|
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