03.06.2020, 07:15
mysql_tquery is basically a threaded MySQL query which shouldn't hang the main thread that the SA-MP server runs on.
Think about it, if you update the kill count in the database for every player, every single kill, and the same for deaths. You will practically execute more queries than you would by using one big query for the account system. More queries are heavier on the performance, so you will save the load on the disconnection and distribute it on other systems that are more frequent than a regular session time.
Players in death match for example kill too often, that means you will send too many update queries for both the killer and the dead, and if you have other data to update it will become hard to manage.
Use one big query for updating a table, and another big query for updating another table. Split queries if you are having too many columns in a single table. Don't mix irrelevant systems under one query just to save performance, and don't execute too many queries and every single update or you'd really have performance issues in an amount of players that is less than 200.
The way of using OnPlayerDisconnect to update data means you are updating the same data you'd update and even less often, in big queries, where each query is used for updating a specific table that is linked with a particular system. That way you have organized your system in a way that works well with performance.
If you update data per specific system, you will then depend on your players to update data and in this situation, if your players are interacting too often, you will have unstable load since it will all depends on what your players do. If there are many players doing many things that update too often, that's more load than just updating any necessary data on disconnection, because it would be less often, and same data will be updated anyway, but in lesser queries. Again saying, MySQL queries are threaded so you shouldn't worry about server hanging.
Think about it, if you update the kill count in the database for every player, every single kill, and the same for deaths. You will practically execute more queries than you would by using one big query for the account system. More queries are heavier on the performance, so you will save the load on the disconnection and distribute it on other systems that are more frequent than a regular session time.
Players in death match for example kill too often, that means you will send too many update queries for both the killer and the dead, and if you have other data to update it will become hard to manage.
Use one big query for updating a table, and another big query for updating another table. Split queries if you are having too many columns in a single table. Don't mix irrelevant systems under one query just to save performance, and don't execute too many queries and every single update or you'd really have performance issues in an amount of players that is less than 200.
The way of using OnPlayerDisconnect to update data means you are updating the same data you'd update and even less often, in big queries, where each query is used for updating a specific table that is linked with a particular system. That way you have organized your system in a way that works well with performance.
If you update data per specific system, you will then depend on your players to update data and in this situation, if your players are interacting too often, you will have unstable load since it will all depends on what your players do. If there are many players doing many things that update too often, that's more load than just updating any necessary data on disconnection, because it would be less often, and same data will be updated anyway, but in lesser queries. Again saying, MySQL queries are threaded so you shouldn't worry about server hanging.