Storing all data in MySQL, or store locally?

Discussion in 'Plugin Development' started by bobacadodl, Jun 2, 2013.

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

    bobacadodl

    I'm creating an extremely large plugin, and I need to store all data in MySQL to make it possible to link with a website.

    Would it be worth my time to store all data locally, then update the MySQL tables every few minutes, or is it ok to just store ALL data in MySQL, and retrieve it/update it constantly? I'd only be making the connection to the MySQL database once, of course. :)
     
  2. Offline

    Jake0oo0

    bobacadodl Storing all data locally would take up a lot of memory, also use an Async task to update SQL.
     
  3. Offline

    bobacadodl

    Well, I'd be fetching player data from my MySQL database onJoin, and updating the player data upon certain events, such as onBlockBreak. My only concern is that executing all of these MySQL queries would be slow.

    I'm not very familiar with MySQL, so I just wanted to know if it would be laggy if I did that.

    Jake0oo0
    Forgot to tag you back :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  4. Offline

    Jake0oo0

    bobacadodl You get a alert on quote, but anyway accessing on BlockBreak and stuff might be a little over the top, but maybe you can look at how logging plugins access SQL constantly.
     
    bobacadodl likes this.
  5. Offline

    bobacadodl

    Great idea, exactly should help, thanks :)
     
  6. Offline

    microgeek

    You have three options really.
    - Update the data as needed, and get it as needed.
    - Have a cache of the data, so you don't need to fetch it from the database each time you use it.
    - Have a cache of the data, and update ever minute or so.

    Any query should be ran in an async event.
     
  7. Offline

    bobacadodl

    I'll be updating/getting as needed. I dont query data as often as block logging plugins, mainly only on onPlayerJoin...
    Thanks for the tips! :)
     
  8. Offline

    microgeek

    Personally, I'd go for the second option. It saves on bandwidth if you are using an offsite database.
     
  9. Offline

    bobacadodl

    Alright, I'll consider doing that
     
Thread Status:
Not open for further replies.

Share This Page