mySQL - what are the advantages/disadvantages?

Discussion in 'Plugin Development' started by Blabba, Feb 18, 2013.

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

    Blabba

    I'm working on my own private plugin for my server and I was considering using mySQL to store the stats of the players. As far as I know, using this would be slower than just loading all the player's data into a big YAML config instance and using that to get the player's stats (I will be recording player kills, deaths, bows fired etc.). I intend for every time a player speaks in chat, their total score would appear before their name so what ever method I use will have to be quick.
    I've never used a database before but I'm more than willing to learn.

    What I really want to know is the advantages and disadvantages of using a mySQL database and examples of areas that you should use it. Since I have never used one before, I don't know much about it at all.
     
  2. Offline

    raGan.

    Keep all scores in memory and save/load only when necessary.
     
  3. Offline

    ohtwo

    I feel like it'd be better for you to create storage in memory (i.e. HashMap) that loads all the values from the database at onEnable, and saves all values at onDisable. Likewise, I don't think simply reading a YAML each time you need to grab data is efficient enough, as from my understanding, you need to go line by line (probably O(N)). You could, however, load the information from the YAML to a HashMap at onEnable as well.

    A major advantage to using mySQL, is you can grab this data on a webpage.
     
  4. Offline

    raGan.

    Actually, loaded config keeps data in memory and only reads file again when reloaded. Using plain old hashmap is still more efficient, though.
     
  5. Offline

    ohtwo

    Good to know. I forgot that its still floating around in memory.
     
  6. Offline

    Blabba

    okay thanks guys :). I think I will just use a YAML config file then save it every 20 minutes or so.
     
Thread Status:
Not open for further replies.

Share This Page