Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2.6, 10.2.7, 10.2.8, 10.3.1
-
Windows 64
Description
A nested query does not return correct results in at least one case.
Scenario:
- A nested query query (Select col... where col in (subquery)) returns empty.
- Subquery correctly returns the rows (x,y,z).
- OuterQuery takes (z,y,z) in an IN statement and correctly selects the relevant results (Select col... where col in (x,y,z))
This is not happening in 10.1 but only on 102 onwards.
I could not reproduce in a simpler scenario. Perhaps this is due to using fulltext search in the subquery, or any other reason.
Details:
https://stackoverflow.com/questions/45964454/subqueries-do-not-work-in-windows-but-works-on-linux
Tables are innodb. Attached the cfg settings I added to my.ini.
Attachments
Issue Links
- is duplicated by
-
MDEV-13994 Bad join results with orderby_uses_equalities=on
-
- Closed
-
- relates to
-
MDEV-13390 Identity server Db Select Statement order by issue.
-
- Closed
-
-
MDEV-13694 Wrong result upon GROUP BY with orderby_uses_equalities=on
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Assignee | Elena Stepanova [ elenst ] |
Link |
This issue relates to |
Link |
This issue relates to |
Component/s | Optimizer [ 10200 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Assignee | Elena Stepanova [ elenst ] | Varun Gupta [ varun ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.2 [ 14601 ] |
Fix Version/s | 10.4 [ 22408 ] |
Link |
This issue is duplicated by |
Fix Version/s | N/A [ 14700 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Resolution | Fixed [ 1 ] | |
Status | Confirmed [ 10101 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 82358 ] | MariaDB v4 [ 152745 ] |
Update: After checking the result of EXPLAIN, it seems that this is related to the use of temporary tables
(please forgive my language, I am not very familiar with SQL)
The version where it does not work has "Using filesort" while the one that works has a "Using temporary; Using filesort"
After finding that the temporary tables could be due to ORDER BY on a same column, I made a workaround :
added a "ORDER BY table1.entityKey DESC" in the subquery.
This seems to resolve the issue. Perhaps it points to a solution.
The query that works is (in bold underlined the addition to make it work) is:
Select table1.entityKey
from table1
where table1.Deleted = 0
and table1.MasterKey is null
and table1.entityTypeKey = 8
and table1.entityKey in
(select table2.entityKey
from table2
where table2.Flag <> 2
and (table2.IndexKey = 4 and MATCH (table2.xhtmltext) AGAINST ('gold')) ORDER BY entityKey DESC)
order by table1.entityKey DESC