Bug #103305 Significantly reduced performance in the NativeDriver class
| Submitted: | 13 Apr 2021 13:10 | Modified: | 19 Apr 2021 11:38 |
|---|---|---|---|
| Reporter: | Slava Tretyak | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | Connector / NET | Severity: | S1 (Critical) |
| Version: | 8.0.23 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[13 Apr 2021 13:19]
Slava Tretyak
I think it is critical issue because all the requests are affected.
[17 Apr 2021 5:13]
Bradley Grainger
Duplicate of bug #101714.
[19 Apr 2021 11:09]
MySQL Verification Team
Hello Slava Tretyak, Thank you for the report and feedback. Imho this is duplicate of Bug #101714, please see Bug #101714. Regards, Ashwini Patil
[19 Apr 2021 11:38]
Slava Tretyak
Yes, it is the duplicate. Sorry, I did not find somehow the same before reporting the issue. Thanks.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: The app is very very slow when loads a lot of records from the database. it does not matter if it is getting a dataset or a data reader. the more records query returns the slower the application. I have found that NativeDriver class was added with a Regexp check in function public IMySqlValue ReadColumnValue(int index, MySqlField field, IMySqlValue valObject) (mysql-connector-net\MySQL.Data\src\NativeDriver.cs) the function is called every time you read the data from each column and each row. and each time it creates Regexp class like Regex regex = new Regex(@"(?i)^[0-9A-F]{8}[-](?:[0-9A-F]{4}[-]){3}[0-9A-F]{12}$"); // check for GUID format and it is very very expensive operation. So when you load for instance 1M records with 5 columns from the database it takes (in our case) about 10-15 minutes. Also the entire CPU usage of the application became much higher. How to repeat: To repeat the issue just request 1M records from a table. you can use either dataset or data reader Suggested fix: Regexp class is thread safe so it can be moved to a static variable and be created one time like private static Regex _guidRegexp = new Regex(@"(?i)^[0-9A-F]{8}[-](?:[0-9A-F]{4}[-]){3}[0-9A-F]{12}$"); // check for GUID format and to use that one instance in public IMySqlValue ReadColumnValue I have fixed the same in our fork and the same query with the same data is loaded 6 times faster.