xjoker_ 25 Posted April 15, 2019 Hello, Let's say I have a database , with like 5k players, 10k vehicles, 5xx groups... And i have to update those very often Is it better to update directly in DB whenever it's needed (for example using extDB3), or to have server variables with a huge number of entries (arrays), and when i want to update something i browse all these arrays, to find some players/objects IDs, update data in those variables, and then update the DB like every X minutes/hours with my variables ? like some sort of "caching system" Is there a limit for what you can store in a variable ? Share this post Link to post Share on other sites
Dedmen 2581 Posted April 15, 2019 31 minutes ago, xjoker_ said: Is there a limit for what you can store in a variable ? There is a length limit for arrays. Also everything in variables has to stay in Ram, which you might not have that much of. 31 minutes ago, xjoker_ said: and when i want to update something i browse all these arrays, to find some players/objects IDs Database solutions are very optimized to allowing you to look up things very quickly. SQF is not. Not at all. Storing values into variables costs basically nothing. In relation to a relatively expensive callExtension for extDB. So just storing into variables would be more performant. Though looking up values might be harder. Might aswell just use a Database mod that doesn't use extDB, like Intercept-DB (advertisement :U) which is about as fast to use as any native SQF code. Share this post Link to post Share on other sites
sarogahtyp 1104 Posted April 15, 2019 1 hour ago, xjoker_ said: Is there a limit for what you can store in a variable ? for arrays its 9,999,999 elements for each array. source Share this post Link to post Share on other sites
code34 248 Posted April 16, 2019 You can build an interface over your code, and schedule a flush all the 5 min callextension as code execution time: dll + all layers to join db + db execution time. Share this post Link to post Share on other sites
killzone_kid 1326 Posted April 16, 2019 Why would you want to keep the whole db in sqf array? This makes no sense, you have max 120 people on the server, you can easily keep each player data that you need to update frequently on the server and send it to the database when player leaves or at some reg interval. Share this post Link to post Share on other sites