[MDEV-9744] session optimizer_use_condition_selectivity=5 causing SQL Error (1918): Encountered illegal value '' when converting to DECIMAL Created: 2016-03-16 Updated: 2018-04-02 Resolved: 2018-04-02 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0, 10.1 |
| Fix Version/s: | 10.0.35 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Nickolay Ihalainen | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
docker mariadb:latest container |
||
| Sprint: | 10.2.13 |
| Description |
|
I'm using docker mariadb:latest container with
Last query producing warnings:
Warnings are not generated for the sequence (select query added before insert select):
Also warnings are not generated normal (not temporary) table b. |
| Comments |
| Comment by Elena Stepanova [ 2016-03-16 ] | |||||||||||||||||||||||||||
|
Thanks for the report. MTR-like test case (same as above):
| |||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-01-24 ] | |||||||||||||||||||||||||||
|
varun, please check if it's reproducible anymore and investigate | |||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-01-30 ] | |||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-01-30 ] | |||||||||||||||||||||||||||
|
S,o, the warning is produced when EITS code tries to calculate condition selectivity here:
Going deeper in the stack: we are in
we are on this line
and we are computing min->val_real(). | |||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-01-30 ] | |||||||||||||||||||||||||||
|
Going back up the stack and looking at column statistics:
Doesn't look like the value is present. Note: I am using the testcase that was modified by Varun as follows: Before ANALYZE TABLE a PERSISTENT FOR ALL I ran insert into a(id,cost) VALUES ( 1, 9.4);, so I do have min and max value in the statistical table:
| |||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-01-30 ] | |||||||||||||||||||||||||||
|
An observation by varun: the query
produces warnings ONLY IF table `b` is a TEMPORARY table. If it is a regular table, no warnings are produced. | |||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-01-30 ] | |||||||||||||||||||||||||||
|
Debugging further: I can see that alloc_statistics_for_table_share is invoked for table a. But I don't see where mysql.column_stats is read. | |||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2018-01-30 ] | |||||||||||||||||||||||||||
|
... and the reason it is not read is this piece in statistics_for_tables_is_needed():
Let's denote this piece of code DONT-READ-STATS. So, for the optimizer the table looks like it has EITS statistiscs, while actually it does not. This bug exposes two issues:
| |||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-02-02 ] | |||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-02-03 ] | |||||||||||||||||||||||||||
|
http://lists.askmonty.org/pipermail/commits/2018-February/011954.html | |||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-04-02 ] | |||||||||||||||||||||||||||
|
Pushed to 10.0 |