• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Plugin] Using MySQL R41-4
#3
(2021-01-13, 04:49 AM)Bakr Wrote: 1) It's not necessary to use MySQL. In a lot of cases it's not even the best solution. How you store the data depends on the data you are storing, how frequently it will be accessed and modified, and the required access to that data. For example, will this data need to be fetched, updated, or displayed from another source; like a forum or control panel?



All these questions should be evaluated. Player data is usually stored in a database for its speed on large data sets and overall flexibility. However if you want to store server configuration settings, that would be better suited in a configuration text file.



2) This also depends on the data. Something that will update frequently (kills, deaths, etc) should be stored in memory and written to the database later. Everything else (passwords, security questions, etc) should be updated immediately.

I'm not so sure about 2...?

I'm pretty sure MySQL can easily handle thousands of UPDATE queries per second on a server that's running 2 core CPU :)



So, I recommend using MySQL over file-based systems for all of the user data and updating them the same moment they change.



MySQL has A LOT of useful features too, like event scheduler, triggers, views,...tl;dr: SQL is much bigger and much more complex language than Pawn so you'll be amazed what you can do without even having any performance impacts on the samp server itself.



For example, let's say you need to look for all of the items owned by offline player - John. That'd be a simple 1-line SELECT query and without any effort you'd have ALL of the data you need whereas INI'd take a lot of effort just to open every file (because the player is offline) and match it up using Pawn VM (like using strcmp to see if the player is item's owner) (which is much much slower than the SQL)
Using Pawn.CMD?

If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
  Reply


Messages In This Thread
Using MySQL R41-4 - by RhaegarX - 2021-01-12, 04:47 PM
RE: Using MySQL R41-4 - by Bakr - 2021-01-13, 04:49 AM
RE: Using MySQL R41-4 - by Pinch - 2021-01-13, 07:07 AM
RE: Using MySQL R41-4 - by Bakr - 2021-01-13, 01:55 PM
RE: Using MySQL R41-4 - by Expert* - 2021-01-18, 08:06 PM

Forum Jump: