Does this DataStore2 take too much memory?

Hi, I heard that DataStores can stop saving if they have more memory than a certain byte, so I was wondering if my data store takes to much space, most of the tables will have up to like a 100 items.

Here is the dicionary so far: (player who was played alot will obviously get more items, like skins, clothing etc)

userData = {
	
	Currency = {	
	["Gems"] = 15;
	["Coins"] = 1500;
	};
	
	
	Items = {
		
		["Weapons"] = {
		["Knife"] = {nil};
		["AK-47"] = {nil}; --the table after the weapons table are skins for the weapons 
                                       --(maybe 60)
		["M9"] = {nil};
		};
		["Clothing"] = {nil};
		};
	
	WeaponsEquipped = {
		["Main"] = {"AK-47"};
		["Secondary"] = {"M9"};
		["Melee"] = {"Knife"};
		["Special"] = {nil};
		};
		
	ClothingEquipped = {
		["Pants"] = {nil};
		["Hats"] = {nil};
		["Shirts"]=  {nil};
		["Face"] = {nil};
	};
}

Hope you understood what I meant!

You have 260,000 characters to store data with, so you should be fine. If you’re really worried, you can represent each weapon, shirt, pants, and whatever else with a number (1, 2, 3, etc) and have a lookup table to get the asset id/tool/whatever from that.

2 Likes

The limit

All datastore key values have a limit of about 260,000 characters. Note that this does depend on the character you use, as some characters such as unicode ones can take up more space.

Ideally, you will never come close to this limit. Unless you store your data very inefficiently, you will never reach this limit.

Datastore2 still uses Roblox datastores (The only special thing they do is store keys in a ordered data store for the purpose of data loss recovery). So, the same limit applys.

Checking how close you are to the limit

If you wanted to check how close you are, well you can! Note that first you will need to enable HttpService. (You do not need to enable HttpService to use the encode and decode functions, my bad.) By encoding the dictionary, we can see the length of the string that will be stored (Roblox Datastores Automatically use this method to encode and decode data into a string, but you do not have to save data as a a string).

local dataS = game:GetService('HttpService'):JSONEncode(userData) --Converts data to a a string
print('You are storing '..string.len(dataS)..' characters of data') --Prints 'You are storing x characters of data'.

Summary

In summary, Datastore2 is subject to the same limitations as regular roblox datastores. Datastore2 is just a module using roblox datastores, it does not have a special different datastore (Though it still is much better and easier to use than regular datastores). If you are worried about reaching limits (which you should not be), then you can simply check how close you are using HttpService:JSONEncode(array). Hope this helped, Have a good day!

3 Likes

Thanks man! Yeah, I think i’ll never come close to 260,000 characters!

Correction;

If I remember correctly, JSONEncode works even with HttpEnabled = false, so this doesn’t apply :slight_smile:

1 Like

Oh, well thanks for the correction. I wasn’t sure, thought the service had to be enabled to use it.

1 Like

HttpEnabled only pertains towards making external requests. Methods under the HttpService, as well as any other method that makes web calls internally, are graced from needing to have that property enabled. A lot of services wouldn’t work if HttpEnabled was required for them.

Roblox can make web calls to its own servers. HttpEnabled is required to send them to other servers.

2 Likes