I am working on an addon which needs to call .txt data everytime when a new player connects. It’s including the player info like country, steamid, ip. I want to make it more efficient. Which one should I use? SQL or file.Write
Depends on your situation. But SQL is better for storing large amounts of data, it’s a lot easier to sort things too. For example, if you use SQL for your situation, you can get all players from canada just with 1 line of code. As with flatfile, you would have to get all the players ever, then sort through manually.
Also, unless you know how to use couroutines properly, operations which require read or writing a billion files at once will freeze the entire server while you’re performing said operation.
I should know. I made ARCBank:^)
Using files can make the server laggy after a while, I’d say SQL without a doubt
just depends on the data you need to store. If large amount then use SQL if small then File.
They’re both used for different situations. In this particular context, you’ll want to use SQL.
In almost every context SQL is better. Files are only better if you want to be able to see and edit something with a text editor.
That’s the entire reason text files exist. They’re completely different contexts Text files are meant to be read by a person, databases are meant to be read by a computer (usually)
Exactly, and even SQL can be accessed visually if you need to. But a database also maintains relationships between tables, ensures that data is in the right format, as does a whole bunch of other great stuff. However, to modify it manually or even view it outside of a GUI made specifically for your exact database, you need specialized software and at least basic knowledge of how databases work. Text files, on the other hand, are just text files. They don’t manage their own integrity in any way and a dumb user can easily wreck the file and render it unreadable.
In short, if the data is fairly flat (i.e. no fancy links between data) and needs to be editable by the Average Joe, then use text files. In all other cases, use SQL.