[Release] MySQL Async Library - 3.3.2

There is no specific function for it but you can achieve the same results using

MySQL.Sync.execute("DELETE * FROM mytable)

I would think.

Hey folks, I’m trying to do something that seems super simple. All I want is for m-a to output the error warnings on queries which exceed a time, but without all the other queries being listed.
If I set mysql_slow_query_warning 50 without setting debug to 1, I get nothing at all. If I set debug to 1 I get everything… Every single query. I’m sure there is a way to just have it tell me about the queries taking longer than 50ms… Can anyone help me out here? This is my entry in the conf.

    set mysql_debug 1
    set mysql_debug_output "both"
    set mysql_slow_query_warning 50
    start mysql-async
  • SELECT Statements that read a Row => .fetchAll e.g. SELECT * FROM characters WHERE cid = @cid LIMIT 1
  • SELECT Statements that read a singular value from a singular row => .fetchScalar e.g. SELECT name FROM characters WHERE cid = @cid LIMIT 1
  • INSERT Statements => .Insert or .execute ; Execute returns the number of rows inserted, Insert returns the Last Insert Id.
  • UPDATE / DELETE Statements => .execute
  • Multiple UPDATE / DELETE / INSERT Statements that belong together => .transaction ; this ensures that if one fails, noone of them are in the database.
  • On bad machines you should prefer Async and Threaded options, on good machines you can use some Sync calls.

@zr0iq Are these suggested additions, or how the resource works? I came to this forum to ask if it was possible to get the last insert id when using INSERT. In MySQL usually you use INSERT INTO() followed by a SELECT LAST_INSERT_ID() but not sure if mysql-async supports passing two queries in the same execute:

MySQL.Async.execute('insert into blah (blah) VALUES(blah); SELECT LAST_INSERT_ID()', {}, function (lastID) print(lastID) end)

Hello Guys i get this error For 2 days now and i cant get it fixed ive tried dooing a hole bunch of things But nothing seems to get it fixed anyone that knows a little more on this or someone that knows how to fix it?
Already thanks for looking at it

1 Like

I love you men, I solved my problem

hi here ! any issue for à problem of duplication,i got a trouble whit mysql or dtb, shes duply mais charach creation, https://gph.is/g/ajWdDNB

Did you fix that?

how i can do this?


i have this problem, i have updated es_extended essentialmode, mysql-async,
but don’t work how to solve?

Try change your connection string to this, it worked well for us:

set mysql_connection_string "mysql://USER:PASS@HOST/DATABASE?supportBigNumbers=true&multipleStatements=true&connectTimeout=60000&acquireTimeout=60000&timeout=60000"

Replace USER, PASS, HOST and DATABASE with your actual details

Updated.

  • Switch to mysql 2.18.1
  • Fixed slow query warnings showing up properly, thanks to @Frosty-Ice
  • Added Date + Time for File Logging, from @Neddings
  • Updated all packages, frontend switched to Vuetify v2 (what a huge overhead).
  • Moved to fxmanifest from __resource.lua, should work with redm.
  • Fixed Sync transactions not working properly, thanks to @niekschoemaker
2 Likes

Thanks man, this fixed a few of the issues we were having so its much appreciated :heart:

Always love some improvements.

Changes

  • Fixed a possible timeout when resources were loading too slow.
  • Added a warning against using MySQL 8, since the performance can be abysmal.

Inserting 1M rows (while the CPU is under light load):

### MySQL 5.7 ###
Average: 15.81ms +- 5.81ms
[Min, Max]: [2ms, 119]ms  

### Mysql 8.0 ###
Average: 27.14ms +- 66.58ms
[Min, Max]: [3ms, 1323]ms

### MariaDB 10.4 ###
Average: 13.93ms +- 5.20ms
[Min, Max]: [3ms, 151]ms

### MariaDB 10.3 ###
Average: 16.38ms +- 7.85ms
[Min, Max]: [2ms, 200]ms
2 Likes

Thank you for the continued work on the resource.

1 Like

I suppose the cache has been cleared and it works now?

No, what the issue was that I added the ssl=none; to the end of the connection string and it was crashing the mysql connection, I removed the ssl=none; from the end of the connection string and rebooted the mysql service and then it was able to connect just fine again.

Btw, I’ve enjoyed the update since May 7th with the warning/error messages for the lengthy mysql queries. It’s nice to see what causing a small bit of a slowdown on the first boot of the server.

Good job bro, thanks for update !

Any way to reduce ms on msyql-async ? like to 0.02ms?

I think this is node overhead, I do not think you can reduce it.