A question about saving huge amount of data through the datastore

So basically I’m making a kind of system where players can explore and donate random players, but only for those player who created their post. And to make this explore algorithm I need to save all players who ever created their posts. And I’m just wondering, will it crush/loss data, because I’m storing huge amount of data, basically here is example:

local Data = {
  [1] = {
    PostTitle = 'hello!';
    PostDescription = 'Can you donate me please?';
    Goal = 100; -- robux
    -- some more misc info
  } -- player userid
  -- and etc.
}

And this data creates /updates when player creates/updates their post.
So I’m wondering:
1. is there better way?
2. Is it safe?

I’m greatful for any answers :smiley:

EDITED:

Here is code I’m using to save this data:

	PostDataStore:UpdateAsync("PostData", function(PlayerData: Enums.ExportedPostdata)
		if PlayerData then
			local UpdatedData = PlayerData
			UpdatedData[tostring(Player.UserId)] = Data
			return UpdatedData
		else
			return {[tostring(Player.UserId)] = Data}
		end
	end)

Switch to profile service, this is by far the better way to accomplish something like this.

Thank you very much for your respond! But does profile service have such a tools for that? And how would I make it more perfomance using profile service?

Profileservice doesnt how any kind of compression however EasyDatastore does. I would recommend using EasyDatastore since not only is it a lot easier to learn but also can save more space.

However I am not sure if there is a specific method of datastore you could use, designed for such purposes, so I would keep looking.

If you do decide to go with a module, chose my datastore module: EasyDatastore!

Sorry but you’re EasyDatastores is completly useless. So it would be better if you’d answer my question :slight_smile:

I tried something like this:

local ProfileStore = ProfileService.GetProfileStore(
	"PlayerDATA1",
	DefaultData
)


-- saving data 

local profileData = ProfileStore:LoadProfileAsync("CurrentData2")
	
profileData.Data[tostring(Player.UserId)] = Data

--

game:BindToClose(function()
	ProfileStore:LoadProfileAsync("CurrentData2"):Release()
end)



but it’s working kinda weird, and I’m not sure it’s the best way.

I’m sure there are plenty of workarounds so that you don’t need to save huge amounts of data, such as making an expiration date for player posts, etc.

But if you don’t want to consider that, you must note that for regular DataStoreService, DataStores can only hold up to 4MB of Data (4 million Characters).

Taking that into account, your solutions are:

  • Use multiple DataStores
  • Compact Data to make more space
  • Use a database from a third party provider

Follow the documentation first, make some basic structures or watch a youtube guide. Then try to save that data. You need to make modules to control data most people call it datamanager, then a template which is basically a table that holds all the data of the player. Here: Setting up - ProfileService
Get a feel of the module before shooting straight for your goal as PS is a bit more complex than most.

1 Like

Thank you very much, but what is ''Thir party provider`? And is profile service is better solution for this case?

ProfileService is always the better option for storing and manipulating data, I reccomend reading it’s documentation and devforum thread.

A third party provider lets you use httpservice to store data in third party locations not handled by roblox.

2 Likes

Hi,

You can currently create datastores that includes 4,194,304 characters. It is very unlikely that you would reach this limit, so do not worry about this.

If you really worry about it, then I would suggest shortening your data names, so do numbers instead of names, and perhaps in string form so you can jump over numbers if needed? - This does so you can even jump over saving some type data if it isn’t used.

local Data = {
  [1] = {
    ["1"] = 'hello!';
    ["2"] = 'Can you donate me please?';
    ["6"] = 100; -- robux
    -- some more misc info
  } -- player userid
  -- and etc.
}

But again, very unlikely that you will ever reach this limit. This were the old method of doing it, when the limit were a few hundred thousands.

I would also suggest that you use Suphi’s data store over any other datastore module available. It is in my opinion just superior overall. Only thing missing is deep-copy reconcile, but no datastore module got that anyway as far as I am aware.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.