Is MySQL a reliable method for saving and gathering data?

Discussion in 'Plugin Development' started by ThunderWaffeMC, Dec 14, 2017.

Thread Status:
Not open for further replies.
  1. Offline


    I'm not greatly knowledgeable of MySQL or databases, but I have enough knowledge to know how to create one and enter/gather values into tables using PHP.

    I have always used .config files to input paths and values in order to use the values in the future. I have had many problems such as file corruption with this method when the config files get larger. There is also a lot of data redundancy with these files. I found that this method is okay for little amounts of data, but what about large amounts? Therefore I was wondering if it is more efficient to use a database to save and gather data (where there are tens of thousands of data entries)?

    Those who have experience with databases and Bukkit, can you tell me how difficult it is to use and if there are any resources I can use to get started for the switch?

    Any input is greatly appreciated
  2. Offline

    timtower Moderator Moderator

    @ThunderWaffeMC It depends on the data that you want to store.
    Small amounts: config.
    Big amounts: depends on the data.

    So what do you want to store?
    Adding new values to the table can be a nasty task as well sometimes, but that depends on how often you do it and how you structured the database (also very important)
  3. Offline


    Thanks for the reply,

    Just mainly booleans, integers and strings less than 14 characters; but there would be an awfully large amount in one field.

    Eg. A table called towns has fields mayor (string), members (string list), open (boolean) and funds (integer).

    Would it be relatively easy in code and a reliable method to obtain the members list and check if the list contains a specific string just like with array lists? And then be able to edit the list ?

  4. Offline

    timtower Moderator Moderator

    @ThunderWaffeMC Depends on how you use the storage.
    It should be loaded on onEnable (or started alongside)
    Then it should reflect edits done with the plugin.
    You should not edit / load from it all the time as that takes time (connection etc)
    And a list of members should be in a different table as you can't put lists in a single cell.

    What data do you want to store besides the given town data?
  5. Offline


    Region data such as ID, owner and members.
    Lock data including location, owner, members.
    Travel point data including location, player, ID.

    I might be heading toward flat file at this stage and just optimising the size of files and when they are created/opened.

    Edit: although, say if there are thousands of 20kb files in a folder, would it be slow to access a value from a specified file? Eg. To search for the file among thousands and open it?
  6. Offline

    timtower Moderator Moderator

Thread Status:
Not open for further replies.

Share This Page