Need opinions!

Discussion in 'Plugin Development' started by wabsta, Feb 8, 2011.

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

    wabsta

    Well, I've been developing my Plugin for the last few days. And I am using MySQL. The thing is.. My plugin needs to check some data every time a block is destroyed by a player. I could just do this using MySQL all the time. Or I could read the database onEnable(), and then check the data from an arraylist or anything.

    Anyway, using just MySQL would save me some time, and will be easier, but do you think this will be too slow, and maybe too demanding for servers?

    Let me know!
     
  2. Offline

    retsrif

    I don't think it would be slow, though I do think it might be demanding on the server to check the file EVERY time a block is destroyed... If you don't need your file to be updated instantly, you could just go with onEnable(), and update the file in periods of time, though if you need instant updates, go with an arraylist like you specified.
     
  3. Offline

    Byteflux

    Assuming you have an active database handle throughout the server's lifetime and preferably with SQL statements precompiled and stored as PreparedStatement or Statement objects, the overhead of repeatedly reading from your database on frequently called events should be minimal.

    Also make sure you are making the most out of indexes on your tables to ensure that row lookups are as fast as possible.
     
  4. Offline

    Plague

    If you do not need the data refreshed every time, of course you should go for the one-time SQL and then local memory. That's the nice and clean way to use.
     
  5. Offline

    wabsta

    Thank you for the comments. I ended up, reading the database on enable, and just made a comment to reload the data from it.
    I think this is the best way so..
     
Thread Status:
Not open for further replies.

Share This Page