Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How big of a table can I save to datastore?

The title explains it all. I have absolutely no clue how big of a table I can save to a datastore key. The wiki doesn't seem to have anything about it. I've heard its something like 64,000KB of JSON but I have no idea how to convert.

5 comments

1

Thanks, but it doesn't state how big 1 letter is in JSON :/ The numbers are useless unless there is a way to determine its size..

0

You'll never reach the limit. simple as that.

0

Actually,reaching the data limit can happen pretty quickly if you save models to a datastore. Take "Whatever Floats Your Boat" as an example of this. Secondly, if you're really worried about reaching the data limit, look into string compression.

0

The wiki tells you exactly how much data would be too much... in the form of JSON. http://wiki.roblox.com/index.php?title=Data_store#Data_limit

1 answer

One key can store 2 ^ 18 string characters (262144) currently, when a table is saved in a data store is it stored in a JSON format which is all handled internally by Roblox.

To give an idea about how much this is you can run the following code:-

print(string.rep('a',  2^18))

If somehow you do meet this limit you can check the string length by manually encoding the table to a JSON using JSONEncode note that you do not need to enable the HttpService to be able to use this function.

A quick example:-

local charLimit = 2 ^ 18
local httpServ = game:GetService('HttpService')

local function chkLimit(tbl)
	return #httpServ:JSONEncode(tbl) < charLimit -- encode to JSON format and check the string length agains the limit
end

I hope this helps.

4 comments

0

Ah, characters, not kibibytes. I presume this table would be 5 out of the 262144. local tbl = {"a", "b", "c", "d", "e"}

0

JSON is a string representation of the table. You need to store all of the JSON for it to be valid so every character in the string counts towards the limit.

0

SO you can turn a table into a string??? Why is nobody explaining it logically....

0

Because you have not said you do not understand JSON, this link should help http://www.json.org/

This discussion is preserved as it was. New answers, comments, and votes are closed.