Bug #93202 connector/net doesn't need to run SHOW VARIABLES
Submitted: 15 Nov 2018 7:06 Modified: 15 Nov 2018 9:13
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S5 (Performance)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[15 Nov 2018 7:06] Shane Bester
Description:
Same request as in:
 https://bugs.mysql.com/bug.php?id=93201

Please do not run SHOW VARIABLES.
Rather use SELECT @@varname;  alternative syntax.

How to repeat:
Look at how serverProps gets populated,  and how it is actually used.
Check method public virtual void Configure(MySqlConnection connection)
in C/NET Driver.cs.

It'll call LoadServerProperties at least once (depending on pool size/CacheServerProperties).

Yet, look when serverProps is referenced on the lines:

string licenseType = serverProps["license"];
MaxPacketSize = Convert.ToInt64(serverProps["max_allowed_packet"]);
serverProps.TryGetValue("character_set_client", out clientCharSet);
serverProps.TryGetValue("character_set_connection", out connCharSet);
string mode = Connection.driver.Property("sql_mode");
int caseSetting = Int32.Parse(connection.driver.Property("lower_case_table_names"));

Suggested fix:
Please optimize this code to avoid SHOW VARIABLES at any cost.
How about this instead:

SELECT @@max_allowed_packet, @@license, @@character_set_client, @@character_set_connection, @@lower_case_table_names, @@sql_mode;
[15 Nov 2018 9:13] Umesh Shastry
Hello Shane,

Thank you for the report.
Observed this with VS 2017 and C/NET 8.0.13.

Regards,
Umesh