Azure Table Storage expiration
Asked Answered
R

2

15

Is there any way to delete items from Azure Table storage without creating a worker to delete based on timestamp ? I want some solution like in Azure cache service where we can specify time span for the message.

Retention answered 26/1, 2012 at 21:38 Comment(0)
M
20

Table Storage is a durable store, and row entities don't have an expiration date. A committed write stays in storage until you delete it. You'd need some type of scheduled task to periodically clean out data based on timestamp or other metadata.

Merola answered 26/1, 2012 at 22:16 Comment(7)
Alternatively, if you have a naming convention for your tables, you could purge old data by simply deleting tables.Zeta
Thanks David and Igor. but i was expecting something like in azure cache service. Now i have to write a worker role which will periodically delete expired tables. i don't like it :( .Retention
Sujith, a worker role is a Windows Server 2008 VM, and you do NOT need a worker role to simply clean up expired tables / rows. You simply need a background thread that runs on a timer or consumes queue messages informing it to perform a cleanup. Also: Azure Table Storage is a durable, persistent store. Just like a SQL Server table, data stays until you delete it. If you want data to age out, then use the Cache service (or other cache software).Merola
Thanks a lot David... i wrote a background thread which is deleting now the expired data. i am new to ASP.Net and i was under the impression that backgroundthreads will work properly only in winforms .Retention
AWS has this on dynamodb :( aws.amazon.com/about-aws/whats-new/2017/02/…Midbrain
@Midbrain How is that detail relevant? This is about Table Storage in Azure. It's not an AWS question, nor a compare/contrast of different cloud service features. Also: This question (and answer) is 5 years old, and there are many different ways to handle this nowadays (including TTL in other Azure data stores such as DocumentDB). But again, irrelevant.Merola
You never know, a Sr Azure architect at Microsoft might stumble across this some day and think - wow, we should add this too ;) feedback.azure.com/forums/217298-storage/suggestions/…Midbrain
S
0

You can create a new table every week for example and delete n-2 old tables. And always write to the nth table

Sholley answered 6/2, 2020 at 10:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.