182 lines
8.5 KiB
JSON
182 lines
8.5 KiB
JSON
[
|
|
{
|
|
"Name": "TestHashPartitionPruner",
|
|
"Cases": [
|
|
{
|
|
"SQL": "explain select * from t1 where id = 7 and a = 6",
|
|
"Result": [
|
|
"TableReader_7 0.00 root partition:p7 data:Selection_6",
|
|
"└─Selection_6 0.00 cop[tikv] eq(test_partition.t1.a, 6)",
|
|
" └─TableRangeScan_5 1.00 cop[tikv] table:t1 range:[7,7], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t3 where id = 9 and a = 1",
|
|
"Result": [
|
|
"Point_Get_1 1.00 root table:t3, partition:p9, index:PRIMARY(id, a) "
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t2 where id = 9 and a = -110",
|
|
"Result": [
|
|
"IndexLookUp_7 1.00 root partition:p1 ",
|
|
"├─IndexRangeScan_5(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[9 -110,9 -110], keep order:false, stats:pseudo",
|
|
"└─TableRowIDScan_6(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t1 where id = -17",
|
|
"Result": [
|
|
"TableReader_6 1.00 root partition:p7 data:TableRangeScan_5",
|
|
"└─TableRangeScan_5 1.00 cop[tikv] table:t1 range:[-17,-17], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t1 join t2 on (t1.id = t2.id) where t1.id = 5 and t2.a = 7",
|
|
"Result": [
|
|
"HashJoin_8 1.00 root CARTESIAN inner join",
|
|
"├─IndexLookUp_14(Build) 1.00 root partition:p2 ",
|
|
"│ ├─IndexRangeScan_12(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[5 7,5 7], keep order:false, stats:pseudo",
|
|
"│ └─TableRowIDScan_13(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
"└─TableReader_11(Probe) 1.00 root partition:p5 data:TableRangeScan_10",
|
|
" └─TableRangeScan_10 1.00 cop[tikv] table:t1 range:[5,5], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t1 left join t2 on t1.id = 1 and t2.a = 2 where t2.id = 7",
|
|
"Result": [
|
|
"HashJoin_7 1.00 root CARTESIAN inner join",
|
|
"├─IndexLookUp_13(Build) 1.00 root partition:p9 ",
|
|
"│ ├─IndexRangeScan_11(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[7 2,7 2], keep order:false, stats:pseudo",
|
|
"│ └─TableRowIDScan_12(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
"└─TableReader_10(Probe) 1.00 root partition:p1 data:TableRangeScan_9",
|
|
" └─TableRangeScan_9 1.00 cop[tikv] table:t1 range:[1,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t2 join t1 on t1.id = t2.id and t2.a = t1.id and t2.id = 12",
|
|
"Result": [
|
|
"HashJoin_7 1.00 root CARTESIAN inner join",
|
|
"├─TableReader_13(Build) 1.00 root partition:p2 data:TableRangeScan_12",
|
|
"│ └─TableRangeScan_12 1.00 cop[tikv] table:t1 range:[12,12], keep order:false, stats:pseudo",
|
|
"└─IndexLookUp_11(Probe) 1.00 root partition:p4 ",
|
|
" ├─IndexRangeScan_9(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[12 12,12 12], keep order:false, stats:pseudo",
|
|
" └─TableRowIDScan_10(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and false",
|
|
"Result": [
|
|
"TableDual_8 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t1 left join t2 on true where t1.a = 1 and null",
|
|
"Result": [
|
|
"TableDual_8 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t1 left join t2 on true where t1.a = null",
|
|
"Result": [
|
|
"TableDual_8 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t4 where d = '2019-10-07 10:40:00' and a = 1",
|
|
"Result": [
|
|
"IndexLookUp_7 1.00 root partition:p9 ",
|
|
"├─IndexRangeScan_5(Build) 1.00 cop[tikv] table:t4, index:PRIMARY(d, a) range:[2019-10-07 10:40:00 1,2019-10-07 10:40:00 1], keep order:false, stats:pseudo",
|
|
"└─TableRowIDScan_6(Probe) 1.00 cop[tikv] table:t4 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t5 where d = '2019-10-07'",
|
|
"Result": [
|
|
"IndexLookUp_10 10.00 root partition:p0 ",
|
|
"├─IndexRangeScan_8(Build) 10.00 cop[tikv] table:t5, index:PRIMARY(d, a) range:[2019-10-07,2019-10-07], keep order:false, stats:pseudo",
|
|
"└─TableRowIDScan_9(Probe) 10.00 cop[tikv] table:t5 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t6 where a is null",
|
|
"Result": [
|
|
"TableReader_7 10.00 root partition:p0 data:Selection_6",
|
|
"└─Selection_6 10.00 cop[tikv] isnull(test_partition.t6.a)",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t6 where b is null",
|
|
"Result": [
|
|
"TableReader_7 10.00 root partition:all data:Selection_6",
|
|
"└─Selection_6 10.00 cop[tikv] isnull(test_partition.t6.b)",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t6 where a = 7 or a = 6",
|
|
"Result": [
|
|
"TableReader_7 20.00 root partition:p0,p1 data:Selection_6",
|
|
"└─Selection_6 20.00 cop[tikv] or(eq(test_partition.t6.a, 7), eq(test_partition.t6.a, 6))",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t6 where a in (6, 7)",
|
|
"Result": [
|
|
"TableReader_7 20.00 root partition:p0,p1 data:Selection_6",
|
|
"└─Selection_6 20.00 cop[tikv] in(test_partition.t6.a, 6, 7)",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t5 where d is null",
|
|
"Result": [
|
|
"TableDual_5 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t7 where b = -3 and a is null",
|
|
"Result": [
|
|
"TableReader_7 0.01 root partition:p0 data:Selection_6",
|
|
"└─Selection_6 0.01 cop[tikv] eq(test_partition.t7.b, -3), isnull(test_partition.t7.a)",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t7 where (a, b) in ((3, 4), (5, 6))",
|
|
"Result": [
|
|
"TableReader_7 0.02 root partition:p1,p7 data:Selection_6",
|
|
"└─Selection_6 0.02 cop[tikv] or(and(eq(test_partition.t7.a, 3), eq(test_partition.t7.b, 4)), and(eq(test_partition.t7.a, 5), eq(test_partition.t7.b, 6)))",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t7 where (a = 1 and b = 2) or (a = 3 and b = 4)",
|
|
"Result": [
|
|
"TableReader_7 0.02 root partition:p3,p7 data:Selection_6",
|
|
"└─Selection_6 0.02 cop[tikv] or(and(eq(test_partition.t7.a, 1), eq(test_partition.t7.b, 2)), and(eq(test_partition.t7.a, 3), eq(test_partition.t7.b, 4)))",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t7 where (a = 1 and b = 2) or (a = 1 and b = 2)",
|
|
"Result": [
|
|
"TableReader_7 0.02 root partition:p3 data:Selection_6",
|
|
"└─Selection_6 0.02 cop[tikv] or(and(eq(test_partition.t7.a, 1), eq(test_partition.t7.b, 2)), and(eq(test_partition.t7.a, 1), eq(test_partition.t7.b, 2)))",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain select * from t7 partition(p0) where (a = 1 and b = 2) or (a = 3 and b = 4)",
|
|
"Result": [
|
|
"TableReader_7 0.02 root partition:dual data:Selection_6",
|
|
"└─Selection_6 0.02 cop[tikv] or(and(eq(test_partition.t7.a, 1), eq(test_partition.t7.b, 2)), and(eq(test_partition.t7.a, 3), eq(test_partition.t7.b, 4)))",
|
|
" └─TableFullScan_5 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|