[MCOL-650] stored procedures with queries invoked over odbc prepared statements take very long Created: 2017-03-30 Updated: 2017-04-05 Resolved: 2017-04-05 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | MariaDB Server |
| Affects Version/s: | 1.0.8 |
| Fix Version/s: | 1.0.9, 1.1.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Thompson (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | community | ||
| Sprint: | 2017-6, 2017-7 |
| Description |
|
Install dbt3 data (i had 5g data set). Create stored procedure:
Now invoke this using ODBC using the mariadb 2.0 connector. I used https://odbcconnect.codeplex.com/. Invoke the same stored procedure call, it will take a long time. Now invoke it with mysql 5.3 odbc driver, it'll be in the same ballpark as mysql client. MariaDB ODBC driver always uses binary prepared statement protocol where mysql odbc uses straight statements by default. Theoretically this might reproduce in other client libraries using prepared statements for making the call but i ran into problems with making this work in php. I could try in java but php is probably preferable for a regression test. When i first tried to reproduce this i used a small data set and so it didn't seem like a problem, so i suspect it is doing something like re-running the query for each row returned or something like that which needs a larger query to see a material difference. Workaround for now is to use the mysql odbc driver and possibly not use prepared statements for other connectors (to be confirmed). |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2017-03-30 ] | ||||||||||||||||||||||
|
OK, so. On the "execute" command of a prepared statement we have a detection routine to check if ColumnStore tables are involved so that we can use vtable. This routine uses the provided table list and checks in it for the underlying tables for views, but not stored procedures. This effectively means vtable is off (in fact vtable is in an undefined state which fires an assert in a debug build). | ||||||||||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-04-03 ] | ||||||||||||||||||||||
|
Two pull requests open, one for develop-1.0 and one for develop For testing I used this PHP code with our regression suite, on a debug build it takes 0.6 seconds using vtable correct and 6 seconds when not. It can be compared with calling "call proctest()" directly in the MariaDB client.
This is the procedure:
| ||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-04-04 ] | ||||||||||||||||||||||
|
Build tested: 1.0.9-1 (branch develop-1.0) Tested with a 10g dbt3 database on a 1um2pm stack MariaDB [dbt3]> delimiter // MariaDB [dbt3]> delimiter ;
----------
---------- MariaDB [dbt3]> quit real 0m0.675s | ||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-04-05 ] | ||||||||||||||||||||||
|
Build verified: 1.1.0-1 (GitHub develop branch) MariaDB [dbt3]> delimiter // MariaDB [dbt3]> delimiter ;
----------
---------- [root@localhost tests]# time php test.php real 0m0.559s |