Skip to content

Instantly share code, notes, and snippets.

@systay
Created August 26, 2021 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save systay/10a47e8f9595734887b58bb872f8d359 to your computer and use it in GitHub Desktop.
Save systay/10a47e8f9595734887b58bb872f8d359 to your computer and use it in GitHub Desktop.
"select id2 from user uu where id in (select id from user where id = uu.id and user.col in (select col from (select col, id, user_id from user_extra where user_id = 5) uu where uu.user_id = uu.id))"
"unsupported: cross-shard correlated subquery"
{
"QueryType": "SELECT",
"Original": "select id2 from user uu where id in (select id from user where id = uu.id and user.col in (select col from (select col, id, user_id from user_extra where user_id = 5) uu where uu.user_id = uu.id))",
"Instructions": {
"OperatorType": "Subquery",
"Variant": "PulloutIn",
"Inputs": [
{
"OperatorType": "Subquery",
"Variant": "PulloutIn",
"Inputs": [
{
"OperatorType": "Route",
"Variant": "SelectEqualUnique",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select col from (select col, id, user_id from user_extra where 1 != 1) as uu where 1 != 1",
"Query": "select col from (select col, id, user_id from user_extra where user_id = 5 and user_id = id) as uu",
"Table": "user_extra",
"Values": [
5
],
"Vindex": "user_index"
},
{
"OperatorType": "Route",
"Variant": "SelectScatter",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select id from `user` where 1 != 1",
"Query": "select id from `user` where `user`.col in ::__sq2",
"Table": "`user`"
}
]
},
{
"OperatorType": "Route",
"Variant": "SelectIN",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select id2 from `user` as uu where 1 != 1",
"Query": "select id2 from `user` as uu where id in ::__vals",
"Table": "`user`",
"Values": [
"::__sq1"
],
"Vindex": "user_index"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment