2021-02-27, 11:30 PM
(2021-02-27, 08:43 PM)Virsenas Wrote:(2021-02-27, 02:26 PM)Kwarde Wrote: Going through "user files"? Is unnecessary? Is an issue somehow? Do you know how MySQL works?
You found the secret text!
If your database (and server, and system, eventually) is set up properly there's no issue at all.
An old InnoDB users table from some server backup, 11.140 rows, 7.2MiB. 97 columns (this database wasn't set up properly). Using the query from above, it takes about 0.0155-0.020 seconds. Selecting all data (*) would take about 0.065-0.07 seconds.
It's on so many levels different than "going through user files" (as in ini-based includes).
Also keep in mind: MySQL is a relational database management system. It's designed (atleast one of the reasons) to be able to perform eventually complex queries to find data in seperate tables,eventually databases. Such a simple query as above is nothing
You can nag about the non-essential things, but I think you don't get my point and my point is:
5 rows < hundreds or thousands of rows / 1 file < hundreds or thousands of files / loading and saving data only for the top5 (5 players) instead of comparing data to hundreds or thousands of players. I know the time difference is not that great, but if I can make things smarter and better then I'm going to do it that way. If you want to do things another way and it works for you then nobody is stopping you. Go ahead. I just showed OP at least how I would have done it.
He isnt saving data for only top 5 he is using the DESC command that is used to sort data in descending order and specifying?the number of records he wants to?return?5, 10, 50?(keyword LIMIT).