For some changes it is a good way to save resource. Like for example statistics or car fuel.
But do not do it for critical data. When for example your power shuts down, it could create weir de-syncs. (Like if you were buying a house ingame: you do not receive the house [in buffer] but the money has already been withdrawn [not in buffer])
You can use MySQL + dbConnect, instead of writing a custom module.
The current MySQL module available is blocking the CPU thread, so that is not really an option for 200 players in my opinion.
Also a way to save resources, is to enable multi_statements:
local connection = dbConnect("sqlite", "database/database.db", "", "", "multi_statements=1")
When for example if you want to remove data at multiple tables.
dbExec(connection,
"DELETE FROM shared_memory_file WHERE clientId = ?;DELETE FROM shared_memory_frame WHERE clientId = ?;DELETE FROM shared_memory_frame_position WHERE clientId = ?",
clientId, clientId, clientId)
Or get data from multiple tables:
dbQuery(processRequestSharedMemory, { player, clientId }, connection, [[
SELECT variantKey, item, fileData FROM shared_memory_file WHERE clientId = ?;
SELECT x, y, item FROM shared_memory_frame WHERE clientId = ?;
SELECT x, y, z FROM shared_memory_frame_position WHERE clientId = ? LIMIT 1
]],
clientId, clientId, clientId)