trolovecro Posted October 8, 2019 Share Posted October 8, 2019 Just so title say, what you guys thinks is better for some simple gamemode. MySQL or .JSON type of storing data. I tried to use one and another. Must say that MySQL is more safer for storing data and more organized (my opinion). But I chose .JSON because it's much easier to get use to work with it, and much simpler for coding then mySQL. What do you guys think? Link to comment Share on other sites More sharing options...
LeonMrBonnie Posted October 8, 2019 Share Posted October 8, 2019 It depends on what data exactly you want to store. For static things that don't change on runtime, I use JSON, for things that CAN change during runtime I use MySQL. 1 Link to comment Share on other sites More sharing options...
trolovecro Posted October 8, 2019 Author Share Posted October 8, 2019 @LeonMrBonnie something like player level? It can be changed during runtime? But actually it's also possible to change it during runtime with .json. But you thinks its better to use MySQL because it's faster then .json? Link to comment Share on other sites More sharing options...
LeonMrBonnie Posted October 8, 2019 Share Posted October 8, 2019 (edited) Yes, I know that it is possible to change a JSON file during runtime, but it is much slower compared to mysql. MySQL also offers way more scalability than JSON. Edited October 8, 2019 by LeonMrBonnie Link to comment Share on other sites More sharing options...
trolovecro Posted October 8, 2019 Author Share Posted October 8, 2019 @LeonMrBonnie what about if i use "file system" asynchronised writing and reading so my code work with that but actually move on other lines of code. https://stackabuse.com/reading-and-writing-json-files-with-node-js/ >>> Quote As I mentioned earlier, the writeFile function executes in asynchronous manner, which means our code is not blocked while data is written to the file. And just like the asynchronous methods from before, we need to pass a callback to this function. What you think about this? Is it safer to use this type of writing and reading? Link to comment Share on other sites More sharing options...
LeonMrBonnie Posted October 8, 2019 Share Posted October 8, 2019 That would be asynchronous like a mysql query, but still slower. 1 Link to comment Share on other sites More sharing options...
trolovecro Posted October 8, 2019 Author Share Posted October 8, 2019 @LeonMrBonnie Thanks for your time and for helpful informations! I learned something new 😀 Link to comment Share on other sites More sharing options...
NMDanny Posted October 9, 2019 Share Posted October 9, 2019 Your real question should be whether to use a relational database(SQL) or a document oriented database(NoSQL), because what you're suggesting - serializing data to JSON files, is basically an ad-hoc document database. There are industrial grade document database such as MongoDB, CouchDB, and even PostgreSQL has pretty good support for JSON, and of course there are plenty of high quality libraries and drivers to interact with these databases via JS/C#. Which is better depends on your usecase. Using NoSQL is good for prototyping/experimentation, there's no need to define a schema, there isn't really a need to use a complex ORM since objects map naturally to documents. But if you already have a good idea of how your data looks like, and its relations, then using a SQL database would be better. Anyway, you can google "SQL vs NoSQL" to see much more in-depth explanations. Anyway, using a real database would be better than making your own file database, and if you're already familiar with MySQL, that would be a good choice. Link to comment Share on other sites More sharing options...
Kar Posted October 9, 2019 Share Posted October 9, 2019 Mongo ❤️ Cassandra ❤️ MariaDB ❤️ Link to comment Share on other sites More sharing options...
xForcer Posted October 9, 2019 Share Posted October 9, 2019 I would choose MySQL over JSON anytime, anyday Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now