Completely wipe the entirety of datastore instead of just removing data of keys or replacing the data store

Shouldn’t there be a way to delete more than just data on keys in data stores or replacing the data store but to remove the keys themselves.
there could be two approaches that this can be a thing. make it where RemoveASync() removes the entire key instead of just the data, or have a new function called DestroyASync() (destroys key and any data it has).

even though the keys have no data. they still seem to exist which means they can still take up server space and can possibly still count against the key limit on data stores.
heres an example.
I used remove async on my datastore and still appears to exist:
store issue

this can become a problem on front page games that save data in data stores.
I hope something can be done to help prevent issues from happening with roblox servers.
-MEABACON_HAlR

2 Likes

RemoveAsync() does indeed remove the key and the data associated with the key. The key can no longer be retrieved with GetAsync(). I’m not sure how you have managed to retrieve it (RemoveAsync() returns the data of the key before being deleted so perhaps that is where you got the result from), but RemoveAsync() does not delete the older versions of the data and actually creates a ‘tombstone’ version of the data, so you’re correct to assume that it will take up space. However, versions get deleted after a set period of time, and can be manually deleted using RemoveVersionAsync().

Firstly, datastores have no real limit as to how many keys you can store - as long as the key itself doesn’t exceed 50 characters in length, it’s considered a valid key, and you can store as many as you like.

The other thing is that RemoveAsync() does remove data from a key the same way as setting nil to a key does, but they both also retain an older version of the data.

In other words, they remove the newest version of the data, but will not remove any older versions (they expire on their own).

GetAsync() will return nil if the newest version is removed by any means.

Finally, some devs have noted that datastore calls won’t register in Studio - only in-game. Maybe this is why you’re getting this issue, so I’d start by looking into this.

One more thing - you don’t actually have to concern yourself with how much data your datastore is storing, only how much data you’re getting from/setting to the datastore.

1 Like

Ok. Thanks for that extra info. I thought the key just stayed there.

1 Like