[MDEV-25168] NULL values from LEFT JOIN Created: 2021-03-16 Updated: 2021-03-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.3.27 |
| Fix Version/s: | 10.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Rich | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Focal (docker) and Debian 10 |
||
| Attachments: |
|
| Description |
|
Fundamentally I have a query like this:
Where the leftJoinedSubQuery returns rows like this:
And the outer returns a row with ID 1 too. Now depending on the WHERE clauses - the something value might show up as NULL for *all* rows, including the row where ID = 1. The actual query is at and copied below:
For example,
I can't reproduce this with dummy data. The tables in use have between 200k and 10M rows each and the query takes ~40s+ to run. I'm not used to Jira, so apols if I've not done this corectly. Note, this rewrite of the query (by dba.stackexchange.com user ypercube - see link above) returns the correct results with and without the ➍ clause. It's very slow compared to the original though.
I've attached the create table statements. |
| Comments |
| Comment by Rich [ 2021-03-17 ] |
|
I just ran this on 10.4.12 9 from docker image and it works. Interestingly it's waaaaay slower, but at least it doesn't lie. Probably can close this? |