Most efficient way to store stats in MySQL?

Discussion in 'Plugin Development' started by NerdsWBNerds, May 31, 2014.

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

    NerdsWBNerds

    So I'm trying to store/load stats using mysql. I'm basically make a little stats library. So you can do .setStat(Player, Key, Value)

    now, I could store this in the 'stats' database, 'players' table, and then in that table have 'id (player uuid), key, value'

    or, I could store it in the 'stats' database, 'player:playername' table, then in that table have 'key', 'value'.

    Which of these methods would be best? Would there be an even more efficient way of doing this?

    I will have around 35k new stats per week, around 10 per player. So I could either have 35k entries in a table, or 3.5k tables with 10 entries in each.
     
  2. Offline

    Arkel

    If you want to know which method is "best" you need to examine how the data will be queried. That being said, I think it's unlikely there will be much of a performance difference between the two methods. Personally I would opt for the first method as it seems to be simpler to manage and the entries are all likely to be very similar, though I am sure there are others who would disagree.
     
    Commander9292 likes this.
Thread Status:
Not open for further replies.

Share This Page