Open pgporada opened 1 year ago
Similar issue: #3644
I think I finally have a better grasp of this issue. The performance regression with extended SET statements stems from the fact that ProxySQL will parse, construct, and send separate SET statements for each recognized system variable. However, when it encounters an extended SET statement containing even a single variable that it doesn't recognize, it will send each variable that it does recognize as a separate statement, and then send the entire extended SET again as a single statement. This has the downside of making the MySQL Server process a SET for each system variable that it already SET, as well as the single variable that ProxySQL didn't recognize.
Hi,
I am running Ubuntu 20.04 with proxysql commit
64f43e5d2b90e85cf82965b92f6fcd9677c2d559
in debug mode withI'm testing that an arbitrary application using
go-sql-driver/mysql
v1.6 and v1.7. In v1.6 of that software, all parameters would now be set in a single transaction - the extended SET from MariaDB/MySQL docs.The following DSN parameters are read from a configuration file:
and these parameters are set inside the application on each session creation.
sql_mode = 'READ-UNCOMMITTED'
https://github.com/letsencrypt/boulder/commit/8fd5861c1fe00d4d3c18c7271f9d464347c23291max_statement_time = 3420
andlong_query_time = 2880
https://github.com/letsencrypt/boulder/blob/main/sa/database.go#L211-L212ProxySQL outputs the following debug lines:
What's interesting to me is that MariaDB 10.6 query logs receive this from ProxySQL.
The line
SET tx_isolation = 'READ-UNCOMMITTED', long_query_time = 2880, max_statement_time = 3420, sql_mode = 'STRICT_ALL_TABLES'
is coming through as an extended SET and the syntax for that isSET var_name = expr [, var_name = expr] ...
.Am I correct in understanding that
long_query_time
andsql_mode
are being SET twice, once as a standalone SET and once in the extended SET? If so, that seems like a performance regression.I do not see a standalone SET for max_statement_time in the MariaDB output, but I do see it in the extended SET.
I do not understand why I am seeing this from proxysql either.
Routing queries through proxysql without extended SET on
go-sql-driver/mysql
v1.5 produces the following messages. Keep in mind here thatsql_mode = 'READ-UNCOMMITTED'
is being set last which avoids problems from this issue.