What is the point of a MySQL Database

Discussion in 'Bukkit Help' started by Kinkstr_101, Jul 31, 2012.

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

    Kinkstr_101

    I have had a server for quite some time and I have been using a database on and off. Right now I really dont know if there is much of a point in using it. Does a database make it easier for a server, or is it something only good for dedicated server? Or is it quicker to store and load files from a database then a flat file? Any help would be greatly helpful.
     
  2. Offline

    Gunnerrrrr

    It's mainly better for big servers and big plugins, such as hawkeye, it stops the server lag by storing the data elsewhere, this will cause less lag and more space for your server, i would highly recommend it.
     
  3. Offline

    Kinkstr_101

    Yeah, thanks for replying btw :p
    Without the database I use CoreProtect, But it seems LogBlock is way better and more plugins are compatible with it like XRayInformer

    The thing is I only own a small server but use plugins that could support a database like:
    LogBlock, MultiInv, PlotMe, WorldGuard and PermissionsEX

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

    MegaNarwhal

    An SQL database is needed to use block logging plugins and recommended for economy plugins, and your server appears to have both of those according to your signature. SQL stores data into tables that you can instantly modify. You can also back up an entire database or just individual tables to one file with 2 commands in command prompt, or set up an automatic backup. I would recommend having an SQL database if your server is public and (of course) you have a plugin or plugins that are able to use an SQL database.

    EDIT: Nooooooooo I'm too late :'( Well, I hope my reply also helps.
     
  5. Offline

    Kinkstr_101

    It has just made up my mind I will use a database for all the plugins that support it, thanks so much guys
     
  6. Offline

    wow4201

    1 Thing to note about implementing a SQL database.

    Say you have a plugin where you gain 10 XP (Special XP that your plugin uses for whatever)
    Everytime you hit a block.

    You do not want to update the SQL database everytime you gain XP.
    What you want to do is. Create a hashmap inside java that holds all this information.
    Update that hashmap when the player hits the block or whatever.

    Then pass that information to SQL when the player logs out. Server stops or at an increment of time(ex every 10min).

    Many great plugins such as mcMMO do not approach it this way, They send SQL queries for everything that is done.
    For instance on my server this would result in about 300+ SQL queries a second. As a result, this plugin would account for about 50% of the total plugin lag that is produced because its so inefficient.

    Why did they approach it like this?
    Cuts the workload (development time) in about 1/2.

    Is there a benefit to this?
    Yes your data is always real time. Changes to the database will take immediate effect in game.

    SQL is great for the following reasons.

    With the right library, implementing functions like getting data, storing data and modifying data is very straight forward using SQL Queries which is very universal.

    Manipulating SQL Data from other applications (Such as a webpage) is very basic using php.

    If you every want to go in manually and modify the data you can access it very easily using a program like navicat.

    Using SQL queries is much more efficient then writing/grabbing data from a file. This is because you don't have to develop algorithms on the most efficient/fastest way to manipulate/read data from a file. SQL does all this for you and stores the data in Memory to increase read/write times 10-100x


    However when it comes down to it. The most important part about writing a plugin, is to understand when to manipulate data from SQL/File and when not to.


    There's no benefit to using a file system over SQL. However learning how to use SQL libraries in java takes some time. Also understanding how SQL works and learning the language to make queries takes time. Sometimes there's no practical advantage of using SQL (In cases where data is manipulated very few times) and you can use a file system instead.

    SQL is something all programmers should be familiar. It is used in most programming languages to deal with data.
     
Thread Status:
Not open for further replies.

Share This Page