Details
-
Bug
-
Resolution: Fixed
-
Minor
-
7.2.0
-
Security Level: Public
-
7.1.2-3378
-
Untriaged
-
1
-
Unknown
Description
index:
CREATE INDEX `idx1` ON `default`(`job_title`,`join_day`,`join_mo`)
Basically I have this query
EXPLAIN select name,join_yr from default where job_title like $job_title and join_mo >= $join_mo and join_yr < $join_yr
when I bind the variable incorrectly through curl
curl -v http://172.23.104.110:8093/query/service -d 'statement=explain select name,join_yr from default where job_title like $job_title and join_mo >= $join_mo and join_yr < $join_yr&$job_title=%25E%25&$join_mo=5&$join_yr=2020' -u Administrator:password
I get an explain plan that is completely wrong, speaking w/sitaram this is because $job_title=%E% instead of the correct binding which is $job_title="%E%", this does not give wrong results as technically this binding is invalid, but why is it leading to an explain that is not correct, namely the _index_key should NOT be join_mo
"plan": {
|
"#operator": "Sequence",
|
"~children": [
|
{
|
"#operator": "IndexScan3",
|
"filter": "($join_mo <= _index_key ((`default`.`join_mo`)))",
|
"index": "idx1",
|
"index_id": "f0e697b2431c0426",
|
"index_keys": [
|
"_index_key ((`default`.`join_mo`))",
|
"_index_key ((meta(`default`).`id`))"
|
],
|
"index_projection": {
|
"entry_keys": [
|
2
|
],
|
"primary_key": true
|
},
|
"keyspace": "default",
|
"namespace": "default",
|
"spans": [
|
{
|
"exact": true,
|
"range": [
|
{
|
"high": "null",
|
"inclusion": 0,
|
"index_key": "`job_title`",
|
"low": "null"
|
}
|
]
|
}
|
],
|
"using": "gsi"
|
},
|
{
|
"#operator": "Fetch",
|
"keyspace": "default",
|
"namespace": "default"
|
},
|
{
|
"#operator": "Parallel",
|
"~child": {
|
"#operator": "Sequence",
|
"~children": [
|
{
|
"#operator": "Filter",
|
"condition": "((((`default`.`job_title`) like $job_title) and ($join_mo <= (`default`.`join_mo`))) and ((`default`.`join_yr`) < $join_yr))"
|
},
|
{
|
"#operator": "InitialProject",
|
"result_terms": [
|
{
|
"expr": "(`default`.`name`)"
|
},
|
{
|
"expr": "(`default`.`join_yr`)"
|
}
|
]
|
}
|
]
|
}
|
}
|
]
|
},
|
"text": "select name,join_yr from default where job_title like $job_title and join_mo >= $join_mo and join_yr < $join_yr"
|
}
|
}
|
]
|