[ODBC-313] Redundant SQLPrimaryKeys calls in applications created with Embarcadero Created: 2021-05-05 Updated: 2023-03-24 Resolved: 2023-03-21 |
|
| Status: | Closed |
| Project: | MariaDB Connector/ODBC |
| Component/s: | General |
| Affects Version/s: | 3.1.12 |
| Fix Version/s: | 3.2.0, 3.1.18 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Lawrin Novitsky | Assignee: | Lawrin Novitsky |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
This is to cover issues described here The main issue is redundant SQLPrimaryKeys calls(INFORMATION_SCHEMA query) - somehow in case of MySQL's driver this call is not done, otherwise show keys from it would be in the log. |
| Comments |
| Comment by Diego Dupin [ 2021-05-05 ] |
|
about @@tx_isolation, mysql deprecate it to replace it with @@transaction_isolation so query has to take server type and version in account |
| Comment by Dušan Pavlica [ 2021-05-06 ] |
|
I added general query logs and odbc trace logs for both mariadb and mysql connectors. |
| Comment by Lawrin Novitsky [ 2021-05-25 ] |
|
DusanP May I ask you to try to use "Force use of forward only cursors"(FORWARDONLY=1 or MADB_OPT_FLAG_FORWARD_CURSOR bit of OPTIONS). I am interested if that will remove those seemingly redundant SQLPrimaryKeys calls(queries from INFORMATION_SCHEMA.COLUMNS in the query log). The purpose of calling them is not clear - I can't see in the trace how SQLPrimaryKeys' results is used. And what can make Embarcadero want to call them is also not clear. To force forward only cursor is my best idea so far. As we have bug of having static, and not forward only cursor a default cursor type(that will be changed in the 3.2 version), and forcing forward only should change that default. |
| Comment by Dušan Pavlica [ 2021-05-25 ] |
|
I added new mariadb logs created in same way as older ones now with 'Force use of forward only cursors' flag checked. |
| Comment by Lawrin Novitsky [ 2021-05-27 ] |
|
DusanP I am not quite familiar with Embarcadero, but atm installing it looks like the best option to figure out why does it adds those SQLPrimaryKeys calls comparing to MySQL's driver. Would it be possible to provide from your side some basic project that would expose those calls? |
| Comment by Dušan Pavlica [ 2021-06-01 ] |
|
I created simple project in C++ Builder 10.4. It contains one connection component, several query components for inserting, deleting and updating records and components for displaying records. There is also create table script and already compiled runnable application in 7z file. |
| Comment by Lawrin Novitsky [ 2021-06-13 ] |
|
Sorry, the fix for the main problem here hasn't made for our last release(3.1.13), simply because I could not yet identify the cause. Other performance optimizations I moved to the separate ticket, and they are in the 3.1.13. I think they should be noticeable in your application if you upgrade the driver to this version. But, as I said, the main problem hasn't been resolved yet. |
| Comment by Dušan Pavlica [ 2022-12-14 ] |
|
Hi, I did some tests with 3.1.17 version just to check if there are some improvements or progress and was surprised that 3.1.17 is much worse then even 3.1.12. I tested loading of our program and with 3.1.12 it took about 30s to start, with 3.1.13 17s and with 3.1.17 it lasted 120s. MySQL ODBC driver 8.0.24 was the quickest - about 5s. All tests were performed with MariaDB server 10.5.9. |
| Comment by Lawrin Novitsky [ 2022-12-14 ] |
|
Thank you for the new information. Looks like I also have to look into this drastic performance degradation. Is it happening on the same database? SQLPrimaryKeys requests INFORMATION_SCHEMA, and queries to INFORMATION_SCHEMA tend to take more time when the there more shemas/tables/columns. |
| Comment by Dušan Pavlica [ 2022-12-14 ] |
|
We use one database with more then 100 tables. And all tests were done on one db server with same data. I switched only connectors, I repeated every test several times and before each test I restarted db server so every test had same conditions at the begining. |
| Comment by Lawrin Novitsky [ 2022-12-16 ] |
|
This is quite a performance regression. Could you also provide a trace for the execution with 3.1.17 driver. I will need to compare with your earlier traces. 120s vs 17s - there must be some reason for that. I guess even if I wanted to deliberately make the driver slower, such regression would be hard to achieve. |
| Comment by Dušan Pavlica [ 2022-12-20 ] |
|
I created trace logs for MariaDB 3.1.13, 3.1.17 and also for MySQL 8.0.24 ODBC connectors. I added also general logs from db server for all connectors. ODBC logs.7z |
| Comment by Lawrin Novitsky [ 2023-03-19 ] |
|
DusanP I've found the reason for SQLPrimaryKeys calls and eliminated it. But with the performance regression in 3.1.17 it's not clear. |
| Comment by Lawrin Novitsky [ 2023-03-21 ] |
|
I am closing it so far, as the problem described in this ticket I believe is solved. As for performance regression - I need feedback, and in case of need we can open new ticket. |
| Comment by Dušan Pavlica [ 2023-03-23 ] |
|
Lawrin I checked the bit in OPTION set and it wasn't set (I had OPTION=0). I also tried to set OPTION to 1048576 and there was no difference. |
| Comment by Lawrin Novitsky [ 2023-03-23 ] |
|
Thanks for feedback. Still not clear why 3.1.17 so slower for you application, than 3.1.13, but I am inclined to blame Embarcadero |