Skip to content

Instantly share code, notes, and snippets.

@atom992
Created April 5, 2017 17:48
Show Gist options
  • Save atom992/68c83a9f455d47e11cfc6ddc642e5c72 to your computer and use it in GitHub Desktop.
Save atom992/68c83a9f455d47e11cfc6ddc642e5c72 to your computer and use it in GitHub Desktop.
CASE WHEN vs UNION SELECT TEST
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 2,
"execTime": "805ns",
"kernTime": "2.835992ms"
},
"~children": [
{
"#operator": "Authorize",
"#stats": {
"#phaseSwitches": 4,
"execTime": "4.722µs",
"kernTime": "1.28849ms",
"servTime": "1.525456ms"
},
"privileges": {
"List": [
{
"Target": "default:default",
"Priv": 1
},
{
"Target": "default:default",
"Priv": 7
}
]
},
"~child": {
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "1.512µs",
"kernTime": "1.28359ms"
},
"~children": [
{
"#operator": "UnionAll",
"#stats": {
"#phaseSwitches": 2,
"execTime": "1.651µs",
"kernTime": "1.257698ms"
},
"~children": [
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "1.614µs",
"kernTime": "1.230814ms"
},
"~children": [
{
"#operator": "UnionAll",
"#stats": {
"#phaseSwitches": 2,
"execTime": "1.138µs",
"kernTime": "1.208663ms"
},
"~children": [
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "3.17µs",
"kernTime": "1.193855ms"
},
"~children": [
{
"#operator": "UnionAll",
"#stats": {
"#phaseSwitches": 2,
"execTime": "1.611µs",
"kernTime": "1.169611ms"
},
"~children": [
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "2.543µs",
"kernTime": "797.92µs"
},
"~children": [
{
"#operator": "IndexScan2",
"#stats": {
"#phaseSwitches": 3,
"execTime": "13.846µs",
"kernTime": "712.952µs"
},
"covers": [
"cover ((`default`.`fieldX`))",
"cover ((`default`.`fieldY`))",
"cover ((`default`.`fieldA`))",
"cover ((`default`.`fieldB`))",
"cover ((`default`.`fieldC`))",
"cover ((`default`.`fieldD`))",
"cover ((`default`.`fieldE`))",
"cover ((`default`.`fieldF`))",
"cover ((`default`.`fieldG`))",
"cover ((`default`.`fieldH`))",
"cover ((`default`.`field1`))",
"cover ((`default`.`field2`))",
"cover ((`default`.`field3`))",
"cover ((`default`.`field4`))",
"cover ((meta(`default`).`id`))"
],
"index": "idx_case_when_union_test_1",
"index_id": "c8f6007b8337e30f",
"index_projection": {
"entry_keys": [
0,
1,
2,
3,
4,
10
]
},
"keyspace": "default",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
},
{
"high": "\"B\"",
"inclusion": 3,
"low": "\"B\""
},
{
"high": "\"C\"",
"inclusion": 3,
"low": "\"C\""
}
]
}
],
"using": "gsi",
"#time_normal": "00:00.0000",
"#time_absolute": 0.000013846000000000001
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "1.597µs",
"kernTime": "771.909µs"
},
"~children": [
{
"#operator": "Filter",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.279µs",
"kernTime": "735.703µs"
},
"condition": "(((((cover ((`default`.`fieldX`)) = \"X\") and (cover ((`default`.`fieldY`)) = \"Y\")) and (cover ((`default`.`fieldA`)) = \"A\")) and (cover ((`default`.`fieldB`)) = \"B\")) and (cover ((`default`.`fieldC`)) = \"C\"))",
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001279
},
{
"#operator": "InitialProject",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.301µs",
"kernTime": "744.482µs"
},
"result_terms": [
{
"as": "field",
"expr": "cover ((`default`.`field1`))"
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001301
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.38µs",
"kernTime": "753.481µs"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.00000138
},
{
"#operator": "FinalProject",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.254µs",
"kernTime": "763.132µs"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001254
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001597
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.3µs",
"kernTime": "784.772µs"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000013
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000002543
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "981ns",
"kernTime": "1.158445ms"
},
"~children": [
{
"#operator": "DistinctScan",
"#stats": {
"#phaseSwitches": 3,
"execTime": "14.689µs",
"servTime": "1.067279ms"
},
"scan": {
"#operator": "IndexScan2",
"#stats": {
"#phaseSwitches": 5,
"execTime": "13.53µs",
"kernTime": "1.042302ms"
},
"covers": [
"cover ((`default`.`fieldX`))",
"cover ((`default`.`fieldY`))",
"cover ((`default`.`fieldA`))",
"cover ((`default`.`fieldB`))",
"cover ((`default`.`fieldC`))",
"cover ((`default`.`fieldD`))",
"cover ((`default`.`fieldE`))",
"cover ((`default`.`fieldF`))",
"cover ((`default`.`fieldG`))",
"cover ((`default`.`fieldH`))",
"cover ((`default`.`field1`))",
"cover ((`default`.`field2`))",
"cover ((`default`.`field3`))",
"cover ((`default`.`field4`))",
"cover ((meta(`default`).`id`))"
],
"index": "idx_case_when_union_test_1",
"index_id": "c8f6007b8337e30f",
"index_projection": {
"entry_keys": [
0,
1,
2,
3,
4,
5,
6,
11
],
"primary_key": true
},
"keyspace": "default",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
},
{
"high": "\"B\"",
"inclusion": 0,
"low": "null"
}
]
},
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
},
{
"inclusion": 0,
"low": "\"B\""
}
]
},
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
}
]
}
],
"using": "gsi",
"#time_normal": "00:00.0000",
"#time_absolute": 0.00001353
},
"#time_normal": "00:00.0010",
"#time_absolute": 0.0010819680000000002
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "1.394µs",
"kernTime": "1.139281ms"
},
"~children": [
{
"#operator": "Filter",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.16µs",
"kernTime": "1.089884ms"
},
"condition": "((((((cover ((`default`.`fieldX`)) = \"X\") and (cover ((`default`.`fieldY`)) = \"Y\")) and (not (((cover ((`default`.`fieldA`)) = \"A\") and (cover ((`default`.`fieldB`)) = \"B\")) and (cover ((`default`.`fieldC`)) = \"C\")))) and (cover ((`default`.`fieldA`)) = \"A\")) and (cover ((`default`.`fieldD`)) = \"D\")) and (cover ((`default`.`fieldE`)) = \"E\"))",
"#time_normal": "00:00.0000",
"#time_absolute": 0.00000116
},
{
"#operator": "InitialProject",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.212µs",
"kernTime": "1.098785ms"
},
"result_terms": [
{
"as": "field",
"expr": "cover ((`default`.`field2`))"
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001212
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.396µs",
"kernTime": "1.107701ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000013959999999999998
},
{
"#operator": "FinalProject",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.479µs",
"kernTime": "1.11874ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000014790000000000002
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001394
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 7,
"execTime": "979ns",
"kernTime": "1.15002ms"
},
"#time_normal": "00:00",
"#time_absolute": 0
}
],
"#time_normal": "00:00",
"#time_absolute": 0
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001611
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.129µs",
"kernTime": "1.181262ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001129
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000031699999999999997
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "1.256µs",
"kernTime": "1.036292ms"
},
"~children": [
{
"#operator": "DistinctScan",
"#stats": {
"#phaseSwitches": 3,
"execTime": "11.787µs",
"servTime": "953.401µs"
},
"scan": {
"#operator": "IndexScan2",
"#stats": {
"#phaseSwitches": 5,
"execTime": "16.445µs",
"kernTime": "910.66µs"
},
"covers": [
"cover ((`default`.`fieldX`))",
"cover ((`default`.`fieldY`))",
"cover ((`default`.`fieldA`))",
"cover ((`default`.`fieldB`))",
"cover ((`default`.`fieldC`))",
"cover ((`default`.`fieldD`))",
"cover ((`default`.`fieldE`))",
"cover ((`default`.`fieldF`))",
"cover ((`default`.`fieldG`))",
"cover ((`default`.`fieldH`))",
"cover ((`default`.`field1`))",
"cover ((`default`.`field2`))",
"cover ((`default`.`field3`))",
"cover ((`default`.`field4`))",
"cover ((meta(`default`).`id`))"
],
"index": "idx_case_when_union_test_1",
"index_id": "c8f6007b8337e30f",
"index_projection": {
"entry_keys": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
12
],
"primary_key": true
},
"keyspace": "default",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
},
{
"high": "\"B\"",
"inclusion": 0,
"low": "null"
}
]
},
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
},
{
"inclusion": 0,
"low": "\"B\""
}
]
},
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
}
]
}
],
"using": "gsi",
"#time_normal": "00:00.0000",
"#time_absolute": 0.000016445
},
"#time_normal": "00:00.0009",
"#time_absolute": 0.000965188
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "1.519µs",
"kernTime": "1.0157ms"
},
"~children": [
{
"#operator": "Filter",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.444µs",
"kernTime": "974.2µs"
},
"condition": "(((((((cover ((`default`.`fieldX`)) = \"X\") and (cover ((`default`.`fieldY`)) = \"Y\")) and (not (((cover ((`default`.`fieldA`)) = \"A\") and (cover ((`default`.`fieldB`)) = \"B\")) and (cover ((`default`.`fieldC`)) = \"C\")))) and (not (((cover ((`default`.`fieldA`)) = \"A\") and (cover ((`default`.`fieldD`)) = \"D\")) and (cover ((`default`.`fieldE`)) = \"E\")))) and (cover ((`default`.`fieldA`)) = \"A\")) and (cover ((`default`.`fieldF`)) = \"F\")) and (cover ((`default`.`fieldG`)) = \"G\"))",
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000014439999999999999
},
{
"#operator": "InitialProject",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.606µs",
"kernTime": "983.386µs"
},
"result_terms": [
{
"as": "field",
"expr": "cover ((`default`.`field3`))"
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000016060000000000002
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 5,
"execTime": "3.199µs",
"kernTime": "994.955µs"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000031989999999999998
},
{
"#operator": "FinalProject",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.306µs",
"kernTime": "1.006095ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001306
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001519
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.297µs",
"kernTime": "1.027152ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001297
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001256
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001138
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.361µs",
"kernTime": "1.219443ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001361
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000016140000000000001
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "1.603µs",
"kernTime": "1.056934ms"
},
"~children": [
{
"#operator": "DistinctScan",
"#stats": {
"#phaseSwitches": 3,
"execTime": "27.345µs",
"servTime": "936.327µs"
},
"scan": {
"#operator": "IndexScan2",
"#stats": {
"#phaseSwitches": 5,
"execTime": "16.626µs",
"kernTime": "915.087µs"
},
"covers": [
"cover ((`default`.`fieldX`))",
"cover ((`default`.`fieldY`))",
"cover ((`default`.`fieldA`))",
"cover ((`default`.`fieldB`))",
"cover ((`default`.`fieldC`))",
"cover ((`default`.`fieldD`))",
"cover ((`default`.`fieldE`))",
"cover ((`default`.`fieldF`))",
"cover ((`default`.`fieldG`))",
"cover ((`default`.`fieldH`))",
"cover ((`default`.`field1`))",
"cover ((`default`.`field2`))",
"cover ((`default`.`field3`))",
"cover ((`default`.`field4`))",
"cover ((meta(`default`).`id`))"
],
"index": "idx_case_when_union_test_1",
"index_id": "c8f6007b8337e30f",
"index_projection": {
"entry_keys": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
13
],
"primary_key": true
},
"keyspace": "default",
"namespace": "default",
"spans": [
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
},
{
"high": "\"B\"",
"inclusion": 0,
"low": "null"
}
]
},
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
},
{
"inclusion": 0,
"low": "\"B\""
}
]
},
{
"exact": true,
"range": [
{
"high": "\"X\"",
"inclusion": 3,
"low": "\"X\""
},
{
"high": "\"Y\"",
"inclusion": 3,
"low": "\"Y\""
},
{
"high": "\"A\"",
"inclusion": 3,
"low": "\"A\""
}
]
}
],
"using": "gsi",
"#time_normal": "00:00.0000",
"#time_absolute": 0.000016626
},
"#time_normal": "00:00.0009",
"#time_absolute": 0.000963672
},
{
"#operator": "Sequence",
"#stats": {
"#phaseSwitches": 3,
"execTime": "11.383µs",
"kernTime": "1.027771ms"
},
"~children": [
{
"#operator": "Filter",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.588µs",
"kernTime": "972.417µs"
},
"condition": "((((((((cover ((`default`.`fieldX`)) = \"X\") and (cover ((`default`.`fieldY`)) = \"Y\")) and (not (((cover ((`default`.`fieldA`)) = \"A\") and (cover ((`default`.`fieldB`)) = \"B\")) and (cover ((`default`.`fieldC`)) = \"C\")))) and (not (((cover ((`default`.`fieldA`)) = \"A\") and (cover ((`default`.`fieldD`)) = \"D\")) and (cover ((`default`.`fieldE`)) = \"E\")))) and (not (((cover ((`default`.`fieldA`)) = \"A\") and (cover ((`default`.`fieldF`)) = \"F\")) and (cover ((`default`.`fieldG`)) = \"G\")))) and (cover ((`default`.`fieldA`)) = \"A\")) and (cover ((`default`.`fieldF`)) = \"F\")) and (cover ((`default`.`fieldH`)) = \"H\"))",
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001588
},
{
"#operator": "InitialProject",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.485µs",
"kernTime": "982.234µs"
},
"result_terms": [
{
"as": "field",
"expr": "cover ((`default`.`field4`))"
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000014850000000000002
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 5,
"execTime": "1.51µs",
"kernTime": "992.497µs"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.00000151
},
{
"#operator": "FinalProject",
"#stats": {
"#phaseSwitches": 7,
"execTime": "7.474µs",
"kernTime": "1.00549ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.000007474
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000011383
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.323µs",
"kernTime": "1.047634ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000013229999999999999
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001603
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001651
},
{
"#operator": "Distinct",
"#stats": {
"#phaseSwitches": 7,
"execTime": "1.993µs",
"kernTime": "1.269804ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.0000019930000000000002
}
],
"#time_normal": "00:00.0000",
"#time_absolute": 0.000001512
},
"#time_normal": "00:00.0015",
"#time_absolute": 0.0015301779999999999
},
{
"#operator": "Stream",
"#stats": {
"#phaseSwitches": 7,
"execTime": "2.58µs",
"kernTime": "2.830286ms"
},
"#time_normal": "00:00.0000",
"#time_absolute": 0.00000258
}
],
"#time_normal": "00:00",
"#time_absolute": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment