Welcome to the Browser-Base Game Zone forums!
So it takes like 0.0246 seconds to call all records where player id=1 from a 1mil unit table. there were 846 results i think. taking the count was pretty much instant. i suspect that it might be faster to have a total in the resource storage table, as I would have less rows? But phpfreak people claim no. I will run some tests on my database and see what sorts of systems are faster.
Quote from: AltarofScience on November 08, 2011, 10:49:11 AMSo it takes like 0.0246 seconds to call all records where player id=1 from a 1mil unit table. there were 846 results i think. taking the count was pretty much instant. i suspect that it might be faster to have a total in the resource storage table, as I would have less rows? But phpfreak people claim no. I will run some tests on my database and see what sorts of systems are faster.You tested it by reading the table by one connection. In the game you will have much more trying to access the table at the some time, tables/rows being locked by other read/write, etc. You can only get a general comparison in such artificial tests. When you put it online it will look completely different (for example in one connection only test MyISAM storage will always be faster than InnoDB, in the real application it could be the opposite).
Okay, I wrote a nice piece of procedural code to generate 100k items to put in storage. I can call COUNT(sid) instantly. I can call all rows where player id = x in 0.00002 seconds. I added a 9 and will now test code speed with 1million results. Any higher and it takes annoyingly long for the code to finish adding new entries, and entries will never be put in in such large quantities anyways. Also it is really easy to delete items from the storage page. And I can use update pretty easily to change locations, by altering x, y coords i think. i will post query speed once all the new entries are in the table.So it takes like 0.0246 seconds to call all records where player id=1 from a 1mil unit table. there were 846 results i think. taking the count was pretty much instant. i suspect that it might be faster to have a total in the resource storage table, as I would have less rows? But phpfreak people claim no. I will run some tests on my database and see what sorts of systems are faster.