Delete All Azure Table Records

CmdrTallen picture CmdrTallen · Oct 12, 2014 · Viewed 16.6k times · Source

I have an Azure Storage Table and it has 3k+ records.

What is the most efficient way to delete all the rows in the table?

Answer

Stopped Contributing picture Stopped Contributing · Oct 12, 2014

For 3000 records, easiest way would be to delete the table. However please note that when you delete the table, it is not deleted at that time but is put in some kind of queue to be deleted and is actually deleted some time later. This time depends on the load on the system + number of entities in the table. During this time, you will not be able to recreate this table or use this table.

If it is important for you to keep using the table, the only other option is to delete entities. For faster deletes, you can look at deleting entities using Entity Batch Transactions. But for deleting entities, you would need to first fetch the entities. You can speed up the fetching process by only fetching PartitionKey and RowKey attributes of the entities instead of fetching all attributes as only these two attributes are required for deleting an entity.