

This means: The DarkRP MySQL implementation is not faster if you use transactions instead of single queries. With MySQL it simply queues the queries in a table and sends them one after the other, no transactions or similar used. With SQLite it uses the sql.Begin() and sql.Commit() functions properly.

The MySQL implementation of DarkRP doesn't do transactions properly. This is where a problem with DarkRP happened. Last but not least: Testing 1000 inserts. Next up a test with a simple SELECT statement.Įxample SQL statement: SELECT rpname FROM darkrp_player WHERE uid = 76561198071737444Įxample SQL statement: "INSERT INTO darkrp_player VALUES(123123,'Test User',1,2)" This can be easily done if we query 1+1 which doesn't need any read/write.Įxample SQL statement to test: SELECT 1+1 Print("DRPMySQL Read Time: ".(endTime-looTime))įirst we test the delay of the database connection. Res = MySQLite.queryValue("SQL_STATEMENT",function(data) Print("SQLite Read Time: ".(endTime-liteTime)) Local res = sql.QueryValue("SQL_STATEMENT") The code used for testing the SQL statements below: The time is measured from first wanting the data until we can use the data. The following tests have been made with DarkRP's implementation for MySQL.

MySQL needs extra connections over the network / between processes which slows it down.

SQLite is cached in RAM which makes access times really fast. Ĭontrary to popular opinion: No, MySQL is not faster than SQLite3 for Garry's Mod. The MySQL database is a MariaDB which is hosted on the same server as the Garry's Mod server. Not every addon provides support for MySQL natively, which means that some addons will still use the local sv.db instead of MySQL.Īll these tests have been made on a 16tick DarkRP server. These modules are not provided by the game and need to be installed manually. With extra modules like mysqloo or tmysql4 you can have MySQL support in Garry's Mod. This database is quite fast and easy to use in LUA, but there is also an alternative to sqlite: MySQL. This database is located at garrysmod/sv.db and uses sqlite3 with in-memory temp-files. Garry's Mod has - by default - an inbuilt sqlite database. Mysql vs sqlite | shira.at MySQL vs SQLite in Garry's Mod's DarkRP gamemode
