Help, SQL Results.

Discussion in 'Plugin Development' started by FurmigaHumana, Apr 27, 2012.

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

    FurmigaHumana

    Hi,

    I spent the last three nights trying to optimize my plugin, I made a significant improvement building a "queue" for the sql, it improved from 1000ms to around 50ms on BlockBreakEvent [test by NoLaggExamine] but I believe it is still high, the only thing missing is to find a way to optimize this code:

    http://pastebin.com/Mt7b4fiL
    This get the block in the database and return if it is protected or not. Is possible do a queue for it too? '-'

    I dont have no ideia of how to improve this, someone please help me!

    Obs: This is kinda a OwnBlocks but isn't for the same thing xD

    Thank you!
     
  2. Offline

    nickrak

    What is the primary key for that table? or any indexes?
     
  3. Offline

    FurmigaHumana

    i use a auto increment> id INT AUTO_INCREMENT, PRIMARY KEY (id)
     
  4. Offline

    nickrak

    You should probably create an index on world, x, y, and z, as a hash. That should speed up that lookup. If you don't use that id anywhere, you may want to consider just using x,y,z,world as your primary key.
     
  5. Offline

    VeryBIgCorp

    What I do is I cache whatever it is into a list. When I have to access something from the database, I just use the list instead.
     
  6. Offline

    FurmigaHumana

    Thank you, i used the tips, i'm almost getting where i want *-*
     
Thread Status:
Not open for further replies.

Share This Page