2909 lines
152 KiB
JSON
2909 lines
152 KiB
JSON
[
|
|
{
|
|
"Name": "TestHashPartitionPruner",
|
|
"Cases": [
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t1 where id = 7 and a = 6",
|
|
"Result": [
|
|
"TableReader 0.00 root partition:p7 data:Selection",
|
|
"└─Selection 0.00 cop[tikv] eq(test_partition.t1.a, 6)",
|
|
" └─TableRangeScan 1.00 cop[tikv] table:t1 range:[7,7], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t3 where id = 9 and a = 1",
|
|
"Result": [
|
|
"Point_Get 1.00 root table:t3, partition:p9, index:PRIMARY(id, a) "
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t2 where id = 9 and a = -110",
|
|
"Result": [
|
|
"IndexLookUp 1.00 root partition:p1 ",
|
|
"├─IndexRangeScan(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[9 -110,9 -110], keep order:false, stats:pseudo",
|
|
"└─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t1 where id = -17",
|
|
"Result": [
|
|
"TableReader 1.00 root partition:p7 data:TableRangeScan",
|
|
"└─TableRangeScan 1.00 cop[tikv] table:t1 range:[-17,-17], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t1 join t2 on (t1.id = t2.id) where t1.id = 5 and t2.a = 7",
|
|
"Result": [
|
|
"HashJoin 1.00 root CARTESIAN inner join",
|
|
"├─IndexLookUp(Build) 1.00 root partition:p2 ",
|
|
"│ ├─IndexRangeScan(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[5 7,5 7], keep order:false, stats:pseudo",
|
|
"│ └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 1.00 root partition:p5 data:TableRangeScan",
|
|
" └─TableRangeScan 1.00 cop[tikv] table:t1 range:[5,5], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t1 left join t2 on t1.id = 1 and t2.a = 2 where t2.id = 7",
|
|
"Result": [
|
|
"HashJoin 1.00 root CARTESIAN inner join",
|
|
"├─IndexLookUp(Build) 1.00 root partition:p9 ",
|
|
"│ ├─IndexRangeScan(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[7 2,7 2], keep order:false, stats:pseudo",
|
|
"│ └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 1.00 root partition:p1 data:TableRangeScan",
|
|
" └─TableRangeScan 1.00 cop[tikv] table:t1 range:[1,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t2 join t1 on t1.id = t2.id and t2.a = t1.id and t2.id = 12",
|
|
"Result": [
|
|
"HashJoin 1.00 root CARTESIAN inner join",
|
|
"├─TableReader(Build) 1.00 root partition:p2 data:TableRangeScan",
|
|
"│ └─TableRangeScan 1.00 cop[tikv] table:t1 range:[12,12], keep order:false, stats:pseudo",
|
|
"└─IndexLookUp(Probe) 1.00 root partition:p4 ",
|
|
" ├─IndexRangeScan(Build) 1.00 cop[tikv] table:t2, index:PRIMARY(id, a) range:[12 12,12 12], keep order:false, stats:pseudo",
|
|
" └─TableRowIDScan(Probe) 1.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t1 left join t2 on true where t1.a = 1 and false",
|
|
"Result": [
|
|
"TableDual 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t1 left join t2 on true where t1.a = 1 and null",
|
|
"Result": [
|
|
"TableDual 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t1 left join t2 on true where t1.a = null",
|
|
"Result": [
|
|
"TableDual 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t4 where d = '2019-10-07 10:40:00' and a = 1",
|
|
"Result": [
|
|
"IndexLookUp 1.00 root partition:p9 ",
|
|
"├─IndexRangeScan(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(Probe) 1.00 cop[tikv] table:t4 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t5 where d = '2019-10-07'",
|
|
"Result": [
|
|
"IndexLookUp 10.00 root partition:p0 ",
|
|
"├─IndexRangeScan(Build) 10.00 cop[tikv] table:t5, index:PRIMARY(d, a) range:[2019-10-07,2019-10-07], keep order:false, stats:pseudo",
|
|
"└─TableRowIDScan(Probe) 10.00 cop[tikv] table:t5 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t6 where a is null",
|
|
"Result": [
|
|
"TableReader 10.00 root partition:p0 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition.t6.a)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t6 where b is null",
|
|
"Result": [
|
|
"TableReader 10.00 root partition:all data:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition.t6.b)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t6 where a = 7 or a = 6",
|
|
"Result": [
|
|
"TableReader 20.00 root partition:p0,p1 data:Selection",
|
|
"└─Selection 20.00 cop[tikv] or(eq(test_partition.t6.a, 7), eq(test_partition.t6.a, 6))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t6 where a in (6, 7)",
|
|
"Result": [
|
|
"TableReader 20.00 root partition:p0,p1 data:Selection",
|
|
"└─Selection 20.00 cop[tikv] in(test_partition.t6.a, 6, 7)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t6 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t5 where d is null",
|
|
"Result": [
|
|
"TableDual 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t7 where b = -3 and a is null",
|
|
"Result": [
|
|
"TableReader 0.01 root partition:p0 data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t7.b, -3), isnull(test_partition.t7.a)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t7 where (a, b) in ((3, 4), (5, 6))",
|
|
"Result": [
|
|
"TableReader 0.02 root partition:p1,p7 data:Selection",
|
|
"└─Selection 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 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t7 where (a = 1 and b = 2) or (a = 3 and b = 4)",
|
|
"Result": [
|
|
"TableReader 0.02 root partition:p3,p7 data:Selection",
|
|
"└─Selection 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 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t7 where (a = 1 and b = 2) or (a = 1 and b = 2)",
|
|
"Result": [
|
|
"TableReader 0.02 root partition:p3 data:Selection",
|
|
"└─Selection 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 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t7 partition(p0) where (a = 1 and b = 2) or (a = 3 and b = 4)",
|
|
"Result": [
|
|
"TableReader 0.02 root partition:dual data:Selection",
|
|
"└─Selection 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 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t8 where a between 10 and 11",
|
|
"Result": [
|
|
"TableReader 250.00 root partition:p4,p5 data:Selection",
|
|
"└─Selection 250.00 cop[tikv] ge(test_partition.t8.a, 10), le(test_partition.t8.a, 11)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t8 where (a is null) or (a between 5 and 8)",
|
|
"Result": [
|
|
"TableReader 260.00 root partition:p0,p1,p2,p5 data:Selection",
|
|
"└─Selection 260.00 cop[tikv] or(isnull(test_partition.t8.a), and(ge(test_partition.t8.a, 5), le(test_partition.t8.a, 8)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t8 where a between 5 and 12",
|
|
"Result": [
|
|
"TableReader 250.00 root partition:all data:Selection",
|
|
"└─Selection 250.00 cop[tikv] ge(test_partition.t8.a, 5), le(test_partition.t8.a, 12)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t8 where (a <= 10 and a >= 8) or (a <= 13 and a >= 11) or (a <= 16 and a >= 14)",
|
|
"Result": [
|
|
"TableReader 750.00 root partition:p0,p1,p2,p3,p4,p5 data:Selection",
|
|
"└─Selection 750.00 cop[tikv] or(and(le(test_partition.t8.a, 10), ge(test_partition.t8.a, 8)), or(and(le(test_partition.t8.a, 13), ge(test_partition.t8.a, 11)), and(le(test_partition.t8.a, 16), ge(test_partition.t8.a, 14))))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t8 where a < 12 and a > 9",
|
|
"Result": [
|
|
"TableReader 250.00 root partition:p4,p5 data:Selection",
|
|
"└─Selection 250.00 cop[tikv] gt(test_partition.t8.a, 9), lt(test_partition.t8.a, 12)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t8 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t9",
|
|
"Result": [
|
|
"TableReader 10000.00 root partition:p0,p1 data:TableFullScan",
|
|
"└─TableFullScan 10000.00 cop[tikv] table:t9 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t10 where a between 0 AND 15218001646226433652",
|
|
"Result": [
|
|
"TableReader 250.00 root partition:all data:Selection",
|
|
"└─Selection 250.00 cop[tikv] ge(test_partition.t10.a, 0), le(test_partition.t10.a, 15218001646226433652)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t10 keep order:false, stats:pseudo"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"Name": "TestListPartitionPruner",
|
|
"Cases": [
|
|
{
|
|
"SQL": "select * from t1 where id = 6 and a = 6",
|
|
"Result": [
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:p1 data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 6), eq(test_partition.t1.id, 6)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where id = 6 and a = 6 and b = 6",
|
|
"Result": [
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.00 root partition:p1 data:Selection",
|
|
"└─Selection 0.00 cop[tikv] eq(test_partition.t2.a, 6), eq(test_partition.t2.b, 6), eq(test_partition.t2.id, 6)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where id = 6 and a = 6",
|
|
"Result": [
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:p1 data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t3.a, 6), eq(test_partition.t3.id, 6)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where id = 6 and (a = 6 or a is null)",
|
|
"Result": [
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.02 root partition:p1 data:Selection",
|
|
"└─Selection 0.02 cop[tikv] eq(test_partition.t1.id, 6), or(eq(test_partition.t1.a, 6), isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where id = 6 and (a = 6 and b = 6 ) or ( a is null and b = 6 )",
|
|
"Result": [
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:all data:Selection",
|
|
"└─Selection 0.01 cop[tikv] or(and(eq(test_partition.t2.id, 6), and(eq(test_partition.t2.a, 6), eq(test_partition.t2.b, 6))), and(isnull(test_partition.t2.a), eq(test_partition.t2.b, 6)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where id = 6 and (a = 6 or a is null)",
|
|
"Result": [
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.02 root partition:p1 data:Selection",
|
|
"└─Selection 0.02 cop[tikv] eq(test_partition.t3.id, 6), or(eq(test_partition.t3.a, 6), isnull(test_partition.t3.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where id = 6 and (a = 1 or a is null)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.02 root partition:p0,p1 data:Selection",
|
|
"└─Selection 0.02 cop[tikv] eq(test_partition.t1.id, 6), or(eq(test_partition.t1.a, 1), isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where id = 6 and (a = 6 and b = 6) or ( a is null and b = 6)",
|
|
"Result": [
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:all data:Selection",
|
|
"└─Selection 0.01 cop[tikv] or(and(eq(test_partition.t2.id, 6), and(eq(test_partition.t2.a, 6), eq(test_partition.t2.b, 6))), and(isnull(test_partition.t2.a), eq(test_partition.t2.b, 6)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where id = 6 and (a = 1 or a is null)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.02 root partition:p0,p1 data:Selection",
|
|
"└─Selection 0.02 cop[tikv] eq(test_partition.t3.id, 6), or(eq(test_partition.t3.a, 1), isnull(test_partition.t3.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where (id = 1 and a = 1) or a is null",
|
|
"Result": [
|
|
"1 1 1",
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.01 root partition:p0,p1 data:Selection",
|
|
"└─Selection 10.01 cop[tikv] or(and(eq(test_partition.t1.id, 1), eq(test_partition.t1.a, 1)), isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where (id = 1 and a = 1 and b = 1) or (a is null and b is null)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:all data:Selection",
|
|
"└─Selection 0.01 cop[tikv] or(and(eq(test_partition.t2.id, 1), and(eq(test_partition.t2.a, 1), eq(test_partition.t2.b, 1))), and(isnull(test_partition.t2.a), isnull(test_partition.t2.b)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where (id = 1 and a = 1) or a is null",
|
|
"Result": [
|
|
"1 1 1",
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.01 root partition:p0,p1 data:Selection",
|
|
"└─Selection 10.01 cop[tikv] or(and(eq(test_partition.t3.id, 1), eq(test_partition.t3.a, 1)), isnull(test_partition.t3.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where (id = 1 and a = 1) or (a = 1 and id = 1)",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.02 root partition:p0 data:Selection",
|
|
"└─Selection 0.02 cop[tikv] or(and(eq(test_partition.t1.id, 1), eq(test_partition.t1.a, 1)), and(eq(test_partition.t1.a, 1), eq(test_partition.t1.id, 1)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where (id = 1 and a = 1 and b = 1) or (a = 1 and id = 1 and b=1)",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.00 root partition:p0 data:Selection",
|
|
"└─Selection 0.00 cop[tikv] or(and(eq(test_partition.t2.id, 1), and(eq(test_partition.t2.a, 1), eq(test_partition.t2.b, 1))), and(eq(test_partition.t2.a, 1), and(eq(test_partition.t2.id, 1), eq(test_partition.t2.b, 1))))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where (id = 1 and a = 1) or (a = 1 and id = 1)",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.02 root partition:p0 data:Selection",
|
|
"└─Selection 0.02 cop[tikv] or(and(eq(test_partition.t3.id, 1), eq(test_partition.t3.a, 1)), and(eq(test_partition.t3.a, 1), eq(test_partition.t3.id, 1)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a is null",
|
|
"Result": [
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:p1 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition.t1.a)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where a is null and b is null",
|
|
"Result": [
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:all data:Selection",
|
|
"└─Selection 0.01 cop[tikv] isnull(test_partition.t2.a), isnull(test_partition.t2.b)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where a is null",
|
|
"Result": [
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:p1 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition.t3.a)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a=id and id >10",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 888.89 root partition:all data:Selection",
|
|
"└─Selection 888.89 cop[tikv] eq(test_partition.t1.a, test_partition.t1.id), gt(test_partition.t1.a, 10), gt(test_partition.t1.id, 10)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where a=id and id >10",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 888.89 root partition:all data:Selection",
|
|
"└─Selection 888.89 cop[tikv] eq(test_partition.t2.a, test_partition.t2.id), gt(test_partition.t2.a, 10), gt(test_partition.t2.id, 10)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where a=id and id >10",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 888.89 root partition:dual data:Selection",
|
|
"└─Selection 888.89 cop[tikv] eq(test_partition.t3.a, test_partition.t3.id), gt(test_partition.t3.a, 10), gt(test_partition.t3.id, 10)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a=id and id >10 or a is null",
|
|
"Result": [
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 898.00 root partition:all data:Selection",
|
|
"└─Selection 898.00 cop[tikv] or(and(eq(test_partition.t1.a, test_partition.t1.id), and(gt(test_partition.t1.id, 10), gt(test_partition.t1.a, 10))), isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where a=id and id >10 or a is null",
|
|
"Result": [
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 898.00 root partition:all data:Selection",
|
|
"└─Selection 898.00 cop[tikv] or(and(eq(test_partition.t2.a, test_partition.t2.id), and(gt(test_partition.t2.id, 10), gt(test_partition.t2.a, 10))), isnull(test_partition.t2.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where a=id and id >10 or a is null",
|
|
"Result": [
|
|
"<nil> <nil> <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 898.00 root partition:p1 data:Selection",
|
|
"└─Selection 898.00 cop[tikv] or(and(eq(test_partition.t3.a, test_partition.t3.id), and(gt(test_partition.t3.id, 10), gt(test_partition.t3.a, 10))), isnull(test_partition.t3.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2) or a=4",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"4 4 4"
|
|
],
|
|
"Plan": [
|
|
"TableReader 30.00 root partition:p0 data:Selection",
|
|
"└─Selection 30.00 cop[tikv] or(in(test_partition.t1.a, 1, 2), eq(test_partition.t1.a, 4))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where a in (1,2) or a=4",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"4 4 4"
|
|
],
|
|
"Plan": [
|
|
"TableReader 30.00 root partition:all data:Selection",
|
|
"└─Selection 30.00 cop[tikv] or(in(test_partition.t2.a, 1, 2), eq(test_partition.t2.a, 4))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where a in (1,2) or a=4",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"4 4 4"
|
|
],
|
|
"Plan": [
|
|
"TableReader 30.00 root partition:p0 data:Selection",
|
|
"└─Selection 30.00 cop[tikv] or(in(test_partition.t3.a, 1, 2), eq(test_partition.t3.a, 4))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2) or a=6",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 30.00 root partition:p0,p1 data:Selection",
|
|
"└─Selection 30.00 cop[tikv] or(in(test_partition.t1.a, 1, 2), eq(test_partition.t1.a, 6))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where (a in (1,2) or a=7) and b = 2",
|
|
"Result": [
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.03 root partition:p0,p1 data:Selection",
|
|
"└─Selection 0.03 cop[tikv] eq(test_partition.t2.b, 2), or(in(test_partition.t2.a, 1, 2), eq(test_partition.t2.a, 7))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where a in (1,2) or a=8",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"8 8 8"
|
|
],
|
|
"Plan": [
|
|
"TableReader 30.00 root partition:p0,p1 data:Selection",
|
|
"└─Selection 30.00 cop[tikv] or(in(test_partition.t3.a, 1, 2), eq(test_partition.t3.a, 8))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where id = 1 or b = 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 19.99 root partition:all data:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition.t1.id, 1), eq(test_partition.t1.b, 1))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where id = 1 or b = 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 19.99 root partition:all data:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition.t2.id, 1), eq(test_partition.t2.b, 1))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where id = 1 or b = 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 19.99 root partition:all data:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition.t3.id, 1), eq(test_partition.t3.b, 1))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableDual 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 where a = 100 and b = 100",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:dual data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t2.a, 100), eq(test_partition.t2.b, 100)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 where a = 100",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:dual data:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition.t3.a, 100)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 partition(p0) where a in (1,3,5,7)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"3 3 3",
|
|
"5 5 5"
|
|
],
|
|
"Plan": [
|
|
"TableReader 40.00 root partition:p0 data:Selection",
|
|
"└─Selection 40.00 cop[tikv] in(test_partition.t1.a, 1, 3, 5, 7)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 partition(p0) where b in (1,3,5,7)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"3 3 3",
|
|
"5 5 5"
|
|
],
|
|
"Plan": [
|
|
"TableReader 40.00 root partition:p0 data:Selection",
|
|
"└─Selection 40.00 cop[tikv] in(test_partition.t2.b, 1, 3, 5, 7)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 partition(p1) where a in (1,3,5,7)",
|
|
"Result": [
|
|
"7 7 7"
|
|
],
|
|
"Plan": [
|
|
"TableReader 40.00 root partition:p1 data:Selection",
|
|
"└─Selection 40.00 cop[tikv] in(test_partition.t1.a, 1, 3, 5, 7)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t2 partition(p1) where a in (1,3,5,7)",
|
|
"Result": [
|
|
"7 7 7"
|
|
],
|
|
"Plan": [
|
|
"TableReader 40.00 root partition:p1 data:Selection",
|
|
"└─Selection 40.00 cop[tikv] in(test_partition.t2.a, 1, 3, 5, 7)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on t1.id = t2.id where (t1.a=1 or t1.a = 3) and (t2.a = 6 and t2.b = 6)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"Projection 0.01 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.a, test_partition.t2.id, test_partition.t2.b",
|
|
"└─HashJoin 0.01 root inner join, equal:[eq(test_partition.t2.id, test_partition.t1.id)]",
|
|
" ├─TableReader(Build) 0.01 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.01 cop[tikv] eq(test_partition.t2.a, 6), eq(test_partition.t2.b, 6), not(isnull(test_partition.t2.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 19.98 root partition:p0 data:Selection",
|
|
" └─Selection 19.98 cop[tikv] not(isnull(test_partition.t1.id)), or(eq(test_partition.t1.a, 1), eq(test_partition.t1.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 left join t3 on t1.id = t3.id where (t1.a=1 or t1.a = 3) and t3.a in (6,7,8)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"HashJoin 24.98 root inner join, equal:[eq(test_partition.t1.id, test_partition.t3.id)]",
|
|
"├─TableReader(Build) 19.98 root partition:p0 data:Selection",
|
|
"│ └─Selection 19.98 cop[tikv] not(isnull(test_partition.t1.id)), or(eq(test_partition.t1.a, 1), eq(test_partition.t1.a, 3))",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 29.97 root partition:p1 data:Selection",
|
|
" └─Selection 29.97 cop[tikv] in(test_partition.t3.a, 6, 7, 8), not(isnull(test_partition.t3.id))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t3 right join t2 on t3.id = t2.id where (t3.a=1 or t3.a = 3) and t2.a in (6,7,8) and t2.b = 6",
|
|
"Result": null,
|
|
"Plan": [
|
|
"Projection 0.04 root test_partition.t3.b, test_partition.t3.id, test_partition.t3.a, test_partition.t2.a, test_partition.t2.id, test_partition.t2.b",
|
|
"└─HashJoin 0.04 root inner join, equal:[eq(test_partition.t2.id, test_partition.t3.id)]",
|
|
" ├─TableReader(Build) 0.03 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.03 cop[tikv] eq(test_partition.t2.b, 6), in(test_partition.t2.a, 6, 7, 8), not(isnull(test_partition.t2.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 19.98 root partition:p0 data:Selection",
|
|
" └─Selection 19.98 cop[tikv] not(isnull(test_partition.t3.id)), or(eq(test_partition.t3.a, 1), eq(test_partition.t3.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on true where t1.a=5 and t2.a in (6,7,8) and t1.a-t2.a=1 and t2.b = 6",
|
|
"Result": null,
|
|
"Plan": [
|
|
"Projection 0.24 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.a, test_partition.t2.id, test_partition.t2.b",
|
|
"└─HashJoin 0.24 root CARTESIAN inner join",
|
|
" ├─TableReader(Build) 0.02 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.02 cop[tikv] eq(minus(5, test_partition.t2.a), 1), eq(test_partition.t2.b, 6), in(test_partition.t2.a, 6, 7, 8)",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 10.00 root partition:p0 data:Selection",
|
|
" └─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 5)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 6 union select * from t1 where a = 1 order by a",
|
|
"Result": [
|
|
"1 1 1",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"Sort 16.00 root Column#10",
|
|
"└─HashAgg 16.00 root group by:Column#10, Column#11, Column#9, funcs:firstrow(Column#9)->Column#9, funcs:firstrow(Column#10)->Column#10, funcs:firstrow(Column#11)->Column#11",
|
|
" └─Union 20.00 root ",
|
|
" ├─TableReader 10.00 root partition:p1 data:Selection",
|
|
" │ └─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 6)",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader 10.00 root partition:p0 data:Selection",
|
|
" └─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t4 join t5 on t4.id = t5.id where (t4.a=1 or t4.a = 3) and (t5.a = 1 or t5.a = 6) and t5.b in (1,6)",
|
|
"Result": [
|
|
"1 1 1 1 1 1"
|
|
],
|
|
"Plan": [
|
|
"HashJoin 2.50 root inner join, equal:[eq(test_partition.t4.id, test_partition.t5.id)]",
|
|
"├─TableReader(Build) 2.00 root partition:p0 data:Selection",
|
|
"│ └─Selection 2.00 cop[tikv] not(isnull(test_partition.t4.id))",
|
|
"│ └─TableRangeScan 2.00 cop[tikv] table:t4 range:[1,1], [3,3], keep order:false, stats:pseudo",
|
|
"└─IndexLookUp(Probe) 4.00 root partition:p0,p1 ",
|
|
" ├─IndexRangeScan(Build) 4.00 cop[tikv] table:t5, index:a(a, b) range:[1 1,1 1], [1 6,1 6], [6 1,6 1], [6 6,6 6], keep order:false, stats:pseudo",
|
|
" └─Selection(Probe) 4.00 cop[tikv] not(isnull(test_partition.t5.id))",
|
|
" └─TableRowIDScan 4.00 cop[tikv] table:t5 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t4 t1 join t4 t2 on t1.id = t2.id where t1.a in (1, 4) and t2.a in (1,3,9,100)",
|
|
"Result": [
|
|
"1 1 1 1 1 1"
|
|
],
|
|
"Plan": [
|
|
"HashJoin 2.50 root inner join, equal:[eq(test_partition.t4.id, test_partition.t4.id)]",
|
|
"├─TableReader(Build) 2.00 root partition:p0 data:Selection",
|
|
"│ └─Selection 2.00 cop[tikv] not(isnull(test_partition.t4.id))",
|
|
"│ └─TableRangeScan 2.00 cop[tikv] table:t1 range:[1,1], [4,4], keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 4.00 root partition:p0,p1 data:Selection",
|
|
" └─Selection 4.00 cop[tikv] not(isnull(test_partition.t4.id))",
|
|
" └─TableRangeScan 4.00 cop[tikv] table:t2 range:[1,1], [3,3], [9,9], [100,100], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t6 t1 join t6 t2 on t1.id = t2.id where t1.a in (1, 4) and t2.a in (1,3,9,100)",
|
|
"Result": [
|
|
"1 1 1 1 1 1"
|
|
],
|
|
"Plan": [
|
|
"HashJoin 24.97 root inner join, equal:[eq(test_partition.t6.id, test_partition.t6.id)]",
|
|
"├─IndexLookUp(Build) 19.98 root partition:p0 ",
|
|
"│ ├─IndexRangeScan(Build) 20.00 cop[tikv] table:t1, index:a(a, b) range:[1,1], [4,4], keep order:false, stats:pseudo",
|
|
"│ └─Selection(Probe) 19.98 cop[tikv] not(isnull(test_partition.t6.id))",
|
|
"│ └─TableRowIDScan 20.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
"└─IndexLookUp(Probe) 39.96 root partition:p0,p1 ",
|
|
" ├─IndexRangeScan(Build) 40.00 cop[tikv] table:t2, index:a(a, b) range:[1,1], [3,3], [9,9], [100,100], keep order:false, stats:pseudo",
|
|
" └─Selection(Probe) 39.96 cop[tikv] not(isnull(test_partition.t6.id))",
|
|
" └─TableRowIDScan 40.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select count(*) from t6 join t5 on t6.b = t5.b where t6.a in (1,2) and t5.a in (1,6) and t5.b in (1,6)",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 4.00 root inner join, equal:[eq(test_partition.t6.b, test_partition.t5.b)]",
|
|
" ├─IndexReader(Build) 4.00 root partition:p0,p1 index:Selection",
|
|
" │ └─Selection 4.00 cop[tikv] not(isnull(test_partition.t5.b))",
|
|
" │ └─IndexRangeScan 4.00 cop[tikv] table:t5, index:a(a, b) range:[1 1,1 1], [1 6,1 6], [6 1,6 1], [6 6,6 6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 4.00 root partition:p0 index:Selection",
|
|
" └─Selection 4.00 cop[tikv] not(isnull(test_partition.t6.b))",
|
|
" └─IndexRangeScan 4.00 cop[tikv] table:t6, index:a(a, b) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select /*+ INL_JOIN(t6,t5) */ count(*) from t6 join t5 on t6.b = t5.b where t6.a in (1,2) and t5.a in (1,6) and t5.b in (1,6)",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─IndexJoin 4.00 root inner join, inner:IndexReader, outer key:test_partition.t6.b, inner key:test_partition.t5.b, equal cond:eq(test_partition.t6.b, test_partition.t5.b)",
|
|
" ├─IndexReader(Build) 4.00 root partition:p0 index:Selection",
|
|
" │ └─Selection 4.00 cop[tikv] not(isnull(test_partition.t6.b))",
|
|
" │ └─IndexRangeScan 4.00 cop[tikv] table:t6, index:a(a, b) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection",
|
|
" └─Selection 1.25 cop[tikv] in(test_partition.t5.b, 1, 6), not(isnull(test_partition.t5.b))",
|
|
" └─IndexRangeScan 625.00 cop[tikv] table:t5, index:a(a, b) range: decided by [eq(test_partition.t5.b, test_partition.t6.b) in(test_partition.t5.a, 1, 6)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select /*+ INL_HASH_JOIN(t5,t6) */ count(*) from t6 join t5 on t6.b = t5.b where t6.a in (1,2) and t5.a in (1,6) and t5.b in (1,6)",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─IndexHashJoin 4.00 root inner join, inner:IndexReader, outer key:test_partition.t6.b, inner key:test_partition.t5.b, equal cond:eq(test_partition.t6.b, test_partition.t5.b)",
|
|
" ├─IndexReader(Build) 4.00 root partition:p0 index:Selection",
|
|
" │ └─Selection 4.00 cop[tikv] not(isnull(test_partition.t6.b))",
|
|
" │ └─IndexRangeScan 4.00 cop[tikv] table:t6, index:a(a, b) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection",
|
|
" └─Selection 1.25 cop[tikv] in(test_partition.t5.b, 1, 6), not(isnull(test_partition.t5.b))",
|
|
" └─IndexRangeScan 625.00 cop[tikv] table:t5, index:a(a, b) range: decided by [eq(test_partition.t5.b, test_partition.t6.b) in(test_partition.t5.a, 1, 6)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t7 where a is null or a > 0 order by a;",
|
|
"Result": [
|
|
"<nil>",
|
|
"1",
|
|
"2"
|
|
],
|
|
"Plan": [
|
|
"Sort 3343.33 root test_partition.t7.a",
|
|
"└─TableReader 3343.33 root partition:all data:Selection",
|
|
" └─Selection 3343.33 cop[tikv] or(isnull(test_partition.t7.a), gt(test_partition.t7.a, 0))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t7 keep order:false, stats:pseudo"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"Name": "TestListColumnsPartitionPruner",
|
|
"Cases": [
|
|
{
|
|
"SQL": "select * from t1 order by id,a",
|
|
"Result": [
|
|
"<nil> 10 <nil>",
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9",
|
|
"10 10 10"
|
|
],
|
|
"Plan": [
|
|
"Sort 10000.00 root test_partition.t1.id, test_partition.t1.a",
|
|
"└─TableReader 10000.00 root partition:all data:TableFullScan",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 10000.00 root test_partition_1.t1.id, test_partition_1.t1.a",
|
|
"└─IndexReader 10000.00 root partition:all index:IndexFullScan",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select count(1) from t1 order by id,a",
|
|
"Result": [
|
|
"11"
|
|
],
|
|
"Plan": [
|
|
"Projection 1.00 root Column#5",
|
|
"└─Sort 1.00 root test_partition.t1.id, test_partition.t1.a",
|
|
" └─StreamAgg 1.00 root funcs:count(Column#10)->Column#5, funcs:firstrow(Column#11)->test_partition.t1.id, funcs:firstrow(Column#12)->test_partition.t1.a",
|
|
" └─TableReader 1.00 root partition:all data:StreamAgg",
|
|
" └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#10, funcs:firstrow(test_partition.t1.id)->Column#11, funcs:firstrow(test_partition.t1.a)->Column#12",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 1.00 root Column#5",
|
|
"└─Sort 1.00 root test_partition_1.t1.id, test_partition_1.t1.a",
|
|
" └─StreamAgg 1.00 root funcs:count(Column#13)->Column#5, funcs:firstrow(Column#14)->test_partition_1.t1.id, funcs:firstrow(Column#15)->test_partition_1.t1.a",
|
|
" └─IndexReader 1.00 root partition:all index:StreamAgg",
|
|
" └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#13, funcs:firstrow(test_partition_1.t1.id)->Column#14, funcs:firstrow(test_partition_1.t1.a)->Column#15",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or b = 2",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 19.99 root partition:p0 data:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 19.99 root partition:p0 index:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition_1.t1.a, 1), eq(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select count(1) from t1 where a = 1 or b = 2",
|
|
"Result": [
|
|
"2"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(Column#7)->Column#5",
|
|
"└─TableReader 1.00 root partition:p0 data:StreamAgg",
|
|
" └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#7",
|
|
" └─Selection 19.99 cop[tikv] or(eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(Column#10)->Column#5",
|
|
"└─IndexReader 1.00 root partition:p0 index:StreamAgg",
|
|
" └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#10",
|
|
" └─Selection 19.99 cop[tikv] or(eq(test_partition_1.t1.a, 1), eq(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 and b = 2",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:dual data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 2)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.10 root partition:dual index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.10 cop[tikv] table:t1, index:a(a, b, id) range:[1 2,1 2], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select count(1) from t1 where a = 1 and b = 2",
|
|
"Result": [
|
|
"0"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#5",
|
|
"└─TableReader 0.01 root partition:dual data:Selection",
|
|
" └─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 2)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#5",
|
|
"└─IndexReader 0.10 root partition:dual index:IndexRangeScan",
|
|
" └─IndexRangeScan 0.10 cop[tikv] table:t1, index:a(a, b, id) range:[1 2,1 2], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 and b = 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:p0 data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.10 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.10 cop[tikv] table:t1, index:a(a, b, id) range:[1 1,1 1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2,3) or b in (4,5,6)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 59.91 root partition:p0,p1 data:Selection",
|
|
"└─Selection 59.91 cop[tikv] or(in(test_partition.t1.a, 1, 2, 3), in(test_partition.t1.b, 4, 5, 6))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 59.91 root partition:p0,p1 index:Selection",
|
|
"└─Selection 59.91 cop[tikv] or(in(test_partition_1.t1.a, 1, 2, 3), in(test_partition_1.t1.b, 4, 5, 6))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2,3) and b in (4,5,6)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.09 root partition:dual data:Selection",
|
|
"└─Selection 0.09 cop[tikv] in(test_partition.t1.a, 1, 2, 3), in(test_partition.t1.b, 4, 5, 6)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.90 root partition:dual index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.90 cop[tikv] table:t1, index:a(a, b, id) range:[1 4,1 4], [1 5,1 5], [1 6,1 6], [2 4,2 4], [2 5,2 5], [2 6,2 6], [3 4,3 4], [3 5,3 5], [3 6,3 6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2,3) and b in (3,4,6)",
|
|
"Result": [
|
|
"3 3 3"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.09 root partition:p0 data:Selection",
|
|
"└─Selection 0.09 cop[tikv] in(test_partition.t1.a, 1, 2, 3), in(test_partition.t1.b, 3, 4, 6)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.90 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.90 cop[tikv] table:t1, index:a(a, b, id) range:[1 3,1 3], [1 4,1 4], [1 6,1 6], [2 3,2 3], [2 4,2 4], [2 6,2 6], [3 3,3 3], [3 4,3 4], [3 6,3 6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2,3) and b in (1,2,3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.09 root partition:p0 data:Selection",
|
|
"└─Selection 0.09 cop[tikv] in(test_partition.t1.a, 1, 2, 3), in(test_partition.t1.b, 1, 2, 3)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.90 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.90 cop[tikv] table:t1, index:a(a, b, id) range:[1 1,1 1], [1 2,1 2], [1 3,1 3], [2 1,2 1], [2 2,2 2], [2 3,2 3], [3 1,3 1], [3 2,3 2], [3 3,3 3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2,3) or b in (1,2,3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3"
|
|
],
|
|
"Plan": [
|
|
"TableReader 59.91 root partition:p0 data:Selection",
|
|
"└─Selection 59.91 cop[tikv] or(in(test_partition.t1.a, 1, 2, 3), in(test_partition.t1.b, 1, 2, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 59.91 root partition:p0 index:Selection",
|
|
"└─Selection 59.91 cop[tikv] or(in(test_partition_1.t1.a, 1, 2, 3), in(test_partition_1.t1.b, 1, 2, 3))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where ( a=1 and b=1) or (a=6 and b=6)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.02 root partition:p0,p1 data:Selection",
|
|
"└─Selection 0.02 cop[tikv] or(and(eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 1)), and(eq(test_partition.t1.a, 6), eq(test_partition.t1.b, 6)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.20 root partition:p0,p1 index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.20 cop[tikv] table:t1, index:a(a, b, id) range:[1 1,1 1], [6 6,6 6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 and b = 100",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:dual data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 100), eq(test_partition.t1.b, 100)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.10 root partition:dual index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.10 cop[tikv] table:t1, index:a(a, b, id) range:[100 100,100 100], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on t1.id = t2.id where (t1.a=1 or t1.a = 3 and t1.b in (3,5)) and t2.a in (6,7,8) and t2.b=7 and t2.id=7",
|
|
"Result": null,
|
|
"Plan": [
|
|
"Projection 0.00 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
"└─HashJoin 0.00 root CARTESIAN inner join",
|
|
" ├─TableReader(Build) 0.00 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.00 cop[tikv] eq(test_partition.t2.b, 7), eq(test_partition.t2.id, 7), in(test_partition.t2.a, 6, 7, 8)",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 0.01 root partition:p0 data:Selection",
|
|
" └─Selection 0.01 cop[tikv] eq(test_partition.t1.id, 7), or(eq(test_partition.t1.a, 1), and(eq(test_partition.t1.a, 3), in(test_partition.t1.b, 3, 5)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"HashJoin 0.03 root CARTESIAN inner join",
|
|
"├─IndexReader(Build) 0.01 root partition:p0 index:Selection",
|
|
"│ └─Selection 0.01 cop[tikv] eq(test_partition_1.t1.id, 7), or(eq(test_partition_1.t1.a, 1), and(eq(test_partition_1.t1.a, 3), in(test_partition_1.t1.b, 3, 5)))",
|
|
"│ └─IndexRangeScan 20.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [3,3], keep order:false, stats:pseudo",
|
|
"└─IndexReader(Probe) 3.00 root partition:p1 index:IndexRangeScan",
|
|
" └─IndexRangeScan 3.00 cop[tikv] table:t2, index:a(a, b, id) range:[6 7 7,6 7 7], [7 7 7,7 7 7], [8 7 7,8 7 7], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 left join t2 on true where (t1.a=1 or t1.a = 3 and t1.b in (3,5)) and t2.a in (6,7,8) and t2.b=7 and t2.id = 7 order by t1.id,t1.a",
|
|
"Result": [
|
|
"1 1 1 7 7 7",
|
|
"3 3 3 7 7 7"
|
|
],
|
|
"Plan": [
|
|
"Sort 0.00 root test_partition.t1.id, test_partition.t1.a",
|
|
"└─Projection 0.00 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
" └─HashJoin 0.00 root CARTESIAN inner join",
|
|
" ├─TableReader(Build) 0.00 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.00 cop[tikv] eq(test_partition.t2.b, 7), eq(test_partition.t2.id, 7), in(test_partition.t2.a, 6, 7, 8)",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 10.02 root partition:p0 data:Selection",
|
|
" └─Selection 10.02 cop[tikv] or(eq(test_partition.t1.a, 1), and(eq(test_partition.t1.a, 3), in(test_partition.t1.b, 3, 5)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 30.60 root test_partition_1.t1.id, test_partition_1.t1.a",
|
|
"└─Projection 30.60 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t2.id, test_partition_1.t2.a, test_partition_1.t2.b",
|
|
" └─HashJoin 30.60 root CARTESIAN inner join",
|
|
" ├─IndexReader(Build) 3.00 root partition:p1 index:IndexRangeScan",
|
|
" │ └─IndexRangeScan 3.00 cop[tikv] table:t2, index:a(a, b, id) range:[6 7 7,6 7 7], [7 7 7,7 7 7], [8 7 7,8 7 7], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 10.20 root partition:p0 index:IndexRangeScan",
|
|
" └─IndexRangeScan 10.20 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [3 3,3 3], [3 5,3 5], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:p0 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.00 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 10.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where b = 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:p0 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition.t1.b, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.00 root partition:p0 index:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition_1.t1.b, 1)",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where b is null",
|
|
"Result": [
|
|
"<nil> 10 <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:p1 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition.t1.b)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.00 root partition:p1 index:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition_1.t1.b)",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a is null",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:dual data:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition.t1.a)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.00 root partition:dual index:IndexRangeScan",
|
|
"└─IndexRangeScan 10.00 cop[tikv] table:t1, index:a(a, b, id) range:[NULL,NULL], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or b = 2",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 19.99 root partition:p0 data:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 19.99 root partition:p0 index:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition_1.t1.a, 1), eq(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or (a = 2 and b = 2) or ((a,b) in ((4,4),(5,5)))",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"4 4 4",
|
|
"5 5 5"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.03 root partition:p0 data:Selection",
|
|
"└─Selection 10.03 cop[tikv] or(or(eq(test_partition.t1.a, 1), and(eq(test_partition.t1.a, 2), eq(test_partition.t1.b, 2))), or(and(eq(test_partition.t1.a, 4), eq(test_partition.t1.b, 4)), and(eq(test_partition.t1.a, 5), eq(test_partition.t1.b, 5))))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.30 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 10.30 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [2 2,2 2], [4 4,4 4], [5 5,5 5], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or (a is null and b = 10)",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.01 root partition:p0 data:Selection",
|
|
"└─Selection 10.01 cop[tikv] or(eq(test_partition.t1.a, 1), and(isnull(test_partition.t1.a), eq(test_partition.t1.b, 10)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 16.00 root partition:p0 index:Selection",
|
|
"└─Selection 16.00 cop[tikv] or(eq(test_partition_1.t1.a, 1), and(isnull(test_partition_1.t1.a), eq(test_partition_1.t1.b, 10)))",
|
|
" └─IndexRangeScan 20.00 cop[tikv] table:t1, index:a(a, b, id) range:[NULL,NULL], [1,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or (a = 10 and b is null)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"<nil> 10 <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.01 root partition:p0,p1 data:Selection",
|
|
"└─Selection 10.01 cop[tikv] or(eq(test_partition.t1.a, 1), and(eq(test_partition.t1.a, 10), isnull(test_partition.t1.b)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.10 root partition:p0,p1 index:IndexRangeScan",
|
|
"└─IndexRangeScan 10.10 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [10 NULL,10 NULL], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 8 or (a = 10 and b is null)",
|
|
"Result": [
|
|
"8 8 8",
|
|
"<nil> 10 <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.01 root partition:p1 data:Selection",
|
|
"└─Selection 10.01 cop[tikv] or(eq(test_partition.t1.a, 8), and(eq(test_partition.t1.a, 10), isnull(test_partition.t1.b)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.10 root partition:p1 index:IndexRangeScan",
|
|
"└─IndexRangeScan 10.10 cop[tikv] table:t1, index:a(a, b, id) range:[8,8], [10 NULL,10 NULL], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 and false",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableDual 0.00 root rows:0"
|
|
],
|
|
"IndexPlan": [
|
|
"TableDual 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 and true",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:p0 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.00 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 10.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or false",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:p0 data:Selection",
|
|
"└─Selection 10.00 cop[tikv] or(eq(test_partition.t1.a, 1), 0)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 10.00 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 10.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or true order by id,a",
|
|
"Result": [
|
|
"<nil> 10 <nil>",
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9",
|
|
"10 10 10"
|
|
],
|
|
"Plan": [
|
|
"Sort 10000.00 root test_partition.t1.id, test_partition.t1.a",
|
|
"└─TableReader 10000.00 root partition:all data:Selection",
|
|
" └─Selection 10000.00 cop[tikv] or(eq(test_partition.t1.a, 1), 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 10000.00 root test_partition_1.t1.id, test_partition_1.t1.a",
|
|
"└─IndexReader 10000.00 root partition:all index:IndexFullScan",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or b in (100,200)",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 29.98 root partition:p0 data:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition.t1.a, 1), in(test_partition.t1.b, 100, 200))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 29.98 root partition:p0 index:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition_1.t1.a, 1), in(test_partition_1.t1.b, 100, 200))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 or b in (1,2)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 29.98 root partition:p0 data:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition.t1.a, 100), in(test_partition.t1.b, 1, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 29.98 root partition:p0 index:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition_1.t1.a, 100), in(test_partition_1.t1.b, 1, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 or b in (1,6)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 29.98 root partition:p0,p1 data:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition.t1.a, 100), in(test_partition.t1.b, 1, 6))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 29.98 root partition:p0,p1 index:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition_1.t1.a, 100), in(test_partition_1.t1.b, 1, 6))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 or b in (100,200)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 29.98 root partition:dual data:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition.t1.a, 100), in(test_partition.t1.b, 100, 200))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 29.98 root partition:dual index:Selection",
|
|
"└─Selection 29.98 cop[tikv] or(eq(test_partition_1.t1.a, 100), in(test_partition_1.t1.b, 100, 200))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,6) or b in (1,2) or (a=3 and b =3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 39.97 root partition:p0,p1 data:Selection",
|
|
"└─Selection 39.97 cop[tikv] or(in(test_partition.t1.a, 1, 6), or(in(test_partition.t1.b, 1, 2), and(eq(test_partition.t1.a, 3), eq(test_partition.t1.b, 3))))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 40.06 root partition:p0,p1 index:Selection",
|
|
"└─Selection 40.06 cop[tikv] or(in(test_partition_1.t1.a, 1, 6), or(in(test_partition_1.t1.b, 1, 2), and(eq(test_partition_1.t1.a, 3), eq(test_partition_1.t1.b, 3))))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,6)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 20.00 root partition:p0,p1 data:Selection",
|
|
"└─Selection 20.00 cop[tikv] in(test_partition.t1.a, 1, 6)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 20.00 root partition:p0,p1 index:IndexRangeScan",
|
|
"└─IndexRangeScan 20.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [6,6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,6) or (a=3 and b =3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"3 3 3",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 20.01 root partition:p0,p1 data:Selection",
|
|
"└─Selection 20.01 cop[tikv] or(in(test_partition.t1.a, 1, 6), and(eq(test_partition.t1.a, 3), eq(test_partition.t1.b, 3)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 20.10 root partition:p0,p1 index:IndexRangeScan",
|
|
"└─IndexRangeScan 20.10 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [3 3,3 3], [6,6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,6) and (a=3 and b =3)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableDual 8000.00 root rows:0"
|
|
],
|
|
"IndexPlan": [
|
|
"TableDual 8000.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 and (b=6 or a=6)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:dual data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 1), or(eq(test_partition.t1.b, 6), 0)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.10 root partition:dual index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.10 cop[tikv] table:t1, index:a(a, b, id) range:[1 6,1 6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 and (b=200 or a=200)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:dual data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 100), or(eq(test_partition.t1.b, 200), 0)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.10 root partition:dual index:IndexRangeScan",
|
|
"└─IndexRangeScan 0.10 cop[tikv] table:t1, index:a(a, b, id) range:[100 200,100 200], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 1 or (a+b=3)",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 8002.00 root partition:all data:Selection",
|
|
"└─Selection 8002.00 cop[tikv] or(eq(test_partition.t1.a, 1), eq(plus(test_partition.t1.a, test_partition.t1.b), 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 8002.00 root partition:all index:Selection",
|
|
"└─Selection 8002.00 cop[tikv] or(eq(test_partition_1.t1.a, 1), eq(plus(test_partition_1.t1.a, test_partition_1.t1.b), 3))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where id = 1 or id=2",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 20.00 root partition:all data:Selection",
|
|
"└─Selection 20.00 cop[tikv] or(eq(test_partition.t1.id, 1), eq(test_partition.t1.id, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 20.00 root partition:all index:Selection",
|
|
"└─Selection 20.00 cop[tikv] or(eq(test_partition_1.t1.id, 1), eq(test_partition_1.t1.id, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where id = 1 and a=1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 0.01 root partition:p0 data:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 1), eq(test_partition.t1.id, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 0.01 root partition:p0 index:Selection",
|
|
"└─Selection 0.01 cop[tikv] eq(test_partition_1.t1.id, 1)",
|
|
" └─IndexRangeScan 10.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 partition(p1) where a = 1 or b = 2",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 19.99 root partition:dual data:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition.t1.a, 1), eq(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 19.99 root partition:dual index:Selection",
|
|
"└─Selection 19.99 cop[tikv] or(eq(test_partition_1.t1.a, 1), eq(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on t1.id = t2.id where (t1.a=1 or t1.a = 3) and (t2.a = 6 and t2.b = 6)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"Projection 0.01 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
"└─HashJoin 0.01 root inner join, equal:[eq(test_partition.t2.id, test_partition.t1.id)]",
|
|
" ├─TableReader(Build) 0.01 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.01 cop[tikv] eq(test_partition.t2.a, 6), eq(test_partition.t2.b, 6), not(isnull(test_partition.t2.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 19.98 root partition:p0 data:Selection",
|
|
" └─Selection 19.98 cop[tikv] not(isnull(test_partition.t1.id)), or(eq(test_partition.t1.a, 1), eq(test_partition.t1.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 1.25 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t2.id, test_partition_1.t2.a, test_partition_1.t2.b",
|
|
"└─HashJoin 1.25 root inner join, equal:[eq(test_partition_1.t2.id, test_partition_1.t1.id)]",
|
|
" ├─IndexReader(Build) 1.00 root partition:p1 index:IndexRangeScan",
|
|
" │ └─IndexRangeScan 1.00 cop[tikv] table:t2, index:a(a, b, id) range:[6 6 -inf,6 6 +inf], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 19.98 root partition:p0 index:Selection",
|
|
" └─Selection 19.98 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
" └─IndexRangeScan 20.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [3,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t1 as t2 on t1.id = t2.id where (t1.a=1 or t1.a = 3) and (t2.a = 6 and t2.b = 6)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"Projection 0.01 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t1.id, test_partition.t1.a, test_partition.t1.b",
|
|
"└─HashJoin 0.01 root inner join, equal:[eq(test_partition.t1.id, test_partition.t1.id)]",
|
|
" ├─TableReader(Build) 0.01 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.01 cop[tikv] eq(test_partition.t1.a, 6), eq(test_partition.t1.b, 6), not(isnull(test_partition.t1.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 19.98 root partition:p0 data:Selection",
|
|
" └─Selection 19.98 cop[tikv] not(isnull(test_partition.t1.id)), or(eq(test_partition.t1.a, 1), eq(test_partition.t1.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 1.25 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b",
|
|
"└─HashJoin 1.25 root inner join, equal:[eq(test_partition_1.t1.id, test_partition_1.t1.id)]",
|
|
" ├─IndexReader(Build) 1.00 root partition:p1 index:IndexRangeScan",
|
|
" │ └─IndexRangeScan 1.00 cop[tikv] table:t2, index:a(a, b, id) range:[6 6 -inf,6 6 +inf], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 19.98 root partition:p0 index:Selection",
|
|
" └─Selection 19.98 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
" └─IndexRangeScan 20.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [3,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where t1.a in (select b from t2 where a in (1,2)) order by a",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"Sort 19.98 root test_partition.t1.a",
|
|
"└─HashJoin 19.98 root inner join, equal:[eq(test_partition.t2.b, test_partition.t1.a)]",
|
|
" ├─HashAgg(Build) 15.98 root group by:test_partition.t2.b, funcs:firstrow(test_partition.t2.b)->test_partition.t2.b",
|
|
" │ └─TableReader 15.98 root partition:p0 data:HashAgg",
|
|
" │ └─HashAgg 15.98 cop[tikv] group by:test_partition.t2.b, ",
|
|
" │ └─Selection 19.98 cop[tikv] in(test_partition.t2.a, 1, 2), not(isnull(test_partition.t2.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 9990.00 root partition:p0,p1 data:Selection",
|
|
" └─Selection 9990.00 cop[tikv] not(isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 199.80 root test_partition_1.t1.a",
|
|
"└─IndexJoin 199.80 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.a)",
|
|
" ├─HashAgg(Build) 159.84 root group by:test_partition_1.t2.b, funcs:firstrow(test_partition_1.t2.b)->test_partition_1.t2.b",
|
|
" │ └─IndexReader 159.84 root partition:p0 index:HashAgg",
|
|
" │ └─HashAgg 159.84 cop[tikv] group by:test_partition_1.t2.b, ",
|
|
" │ └─IndexRangeScan 199.80 cop[tikv] table:t2, index:a(a, b, id) range:[1 -inf,1 +inf], [2 -inf,2 +inf], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection",
|
|
" └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))",
|
|
" └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t2.b)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where t1.a in (select b from t1 where a in (1,2)) order by a",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"Sort 19.98 root test_partition.t1.a",
|
|
"└─HashJoin 19.98 root inner join, equal:[eq(test_partition.t1.b, test_partition.t1.a)]",
|
|
" ├─HashAgg(Build) 15.98 root group by:test_partition.t1.b, funcs:firstrow(test_partition.t1.b)->test_partition.t1.b",
|
|
" │ └─TableReader 15.98 root partition:p0 data:HashAgg",
|
|
" │ └─HashAgg 15.98 cop[tikv] group by:test_partition.t1.b, ",
|
|
" │ └─Selection 19.98 cop[tikv] in(test_partition.t1.a, 1, 2), not(isnull(test_partition.t1.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 9990.00 root partition:p0,p1 data:Selection",
|
|
" └─Selection 9990.00 cop[tikv] not(isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 199.80 root test_partition_1.t1.a",
|
|
"└─IndexJoin 199.80 root inner join, inner:IndexReader, outer key:test_partition_1.t1.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t1.b, test_partition_1.t1.a)",
|
|
" ├─HashAgg(Build) 159.84 root group by:test_partition_1.t1.b, funcs:firstrow(test_partition_1.t1.b)->test_partition_1.t1.b",
|
|
" │ └─IndexReader 159.84 root partition:p0 index:HashAgg",
|
|
" │ └─HashAgg 159.84 cop[tikv] group by:test_partition_1.t1.b, ",
|
|
" │ └─IndexRangeScan 199.80 cop[tikv] table:t1, index:a(a, b, id) range:[1 -inf,1 +inf], [2 -inf,2 +inf], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection",
|
|
" └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))",
|
|
" └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t1.b)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 left join t2 on t1.id = t2.id where (t1.a=1 or t1.a = 3) and t2.a in (6,7,8)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"HashJoin 24.98 root inner join, equal:[eq(test_partition.t1.id, test_partition.t2.id)]",
|
|
"├─TableReader(Build) 19.98 root partition:p0 data:Selection",
|
|
"│ └─Selection 19.98 cop[tikv] not(isnull(test_partition.t1.id)), or(eq(test_partition.t1.a, 1), eq(test_partition.t1.a, 3))",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 29.97 root partition:p1 data:Selection",
|
|
" └─Selection 29.97 cop[tikv] in(test_partition.t2.a, 6, 7, 8), not(isnull(test_partition.t2.id))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"HashJoin 24.98 root inner join, equal:[eq(test_partition_1.t1.id, test_partition_1.t2.id)]",
|
|
"├─IndexReader(Build) 19.98 root partition:p0 index:Selection",
|
|
"│ └─Selection 19.98 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
"│ └─IndexRangeScan 20.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [3,3], keep order:false, stats:pseudo",
|
|
"└─IndexReader(Probe) 29.97 root partition:p1 index:Selection",
|
|
" └─Selection 29.97 cop[tikv] not(isnull(test_partition_1.t2.id))",
|
|
" └─IndexRangeScan 30.00 cop[tikv] table:t2, index:a(a, b, id) range:[6,6], [7,7], [8,8], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 right join t2 on t1.id = t2.id where (t1.a=1 or t1.a = 3) and t2.a in (1,2,3)",
|
|
"Result": [
|
|
"1 1 1 1 1 1",
|
|
"3 3 3 3 3 3"
|
|
],
|
|
"Plan": [
|
|
"HashJoin 24.98 root inner join, equal:[eq(test_partition.t1.id, test_partition.t2.id)]",
|
|
"├─TableReader(Build) 19.98 root partition:p0 data:Selection",
|
|
"│ └─Selection 19.98 cop[tikv] not(isnull(test_partition.t1.id)), or(eq(test_partition.t1.a, 1), eq(test_partition.t1.a, 3))",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 29.97 root partition:p0 data:Selection",
|
|
" └─Selection 29.97 cop[tikv] in(test_partition.t2.a, 1, 2, 3), not(isnull(test_partition.t2.id))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"HashJoin 24.98 root inner join, equal:[eq(test_partition_1.t1.id, test_partition_1.t2.id)]",
|
|
"├─IndexReader(Build) 19.98 root partition:p0 index:Selection",
|
|
"│ └─Selection 19.98 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
"│ └─IndexRangeScan 20.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [3,3], keep order:false, stats:pseudo",
|
|
"└─IndexReader(Probe) 29.97 root partition:p0 index:Selection",
|
|
" └─Selection 29.97 cop[tikv] not(isnull(test_partition_1.t2.id))",
|
|
" └─IndexRangeScan 30.00 cop[tikv] table:t2, index:a(a, b, id) range:[1,1], [2,2], [3,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on true where t1.a=5 and t2.a in (6,7,8) and t2.b = 6",
|
|
"Result": [
|
|
"5 5 5 6 6 6"
|
|
],
|
|
"Plan": [
|
|
"Projection 0.30 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
"└─HashJoin 0.30 root CARTESIAN inner join",
|
|
" ├─TableReader(Build) 0.03 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.03 cop[tikv] eq(test_partition.t2.b, 6), in(test_partition.t2.a, 6, 7, 8)",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 10.00 root partition:p0 data:Selection",
|
|
" └─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 5)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 3.00 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t2.id, test_partition_1.t2.a, test_partition_1.t2.b",
|
|
"└─HashJoin 3.00 root CARTESIAN inner join",
|
|
" ├─IndexReader(Build) 0.30 root partition:p1 index:IndexRangeScan",
|
|
" │ └─IndexRangeScan 0.30 cop[tikv] table:t2, index:a(a, b, id) range:[6 6,6 6], [7 6,7 6], [8 6,8 6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 10.00 root partition:p0 index:IndexRangeScan",
|
|
" └─IndexRangeScan 10.00 cop[tikv] table:t1, index:a(a, b, id) range:[5,5], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select count(*) from t1 join t2 on t1.b = t2.b where t1.a in (1,2) and t2.a in (1,6) and t1.b in (1,6)",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 0.00 root inner join, equal:[eq(test_partition.t1.b, test_partition.t2.b)]",
|
|
" ├─TableReader(Build) 0.04 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 0.04 cop[tikv] in(test_partition.t2.a, 1, 6), in(test_partition.t2.b, 1, 6), not(isnull(test_partition.t2.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 0.04 root partition:p0 data:Selection",
|
|
" └─Selection 0.04 cop[tikv] in(test_partition.t1.a, 1, 2), in(test_partition.t1.b, 1, 6), not(isnull(test_partition.t1.b))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 0.10 root inner join, equal:[eq(test_partition_1.t1.b, test_partition_1.t2.b)]",
|
|
" ├─IndexReader(Build) 0.40 root partition:p0,p1 index:Selection",
|
|
" │ └─Selection 0.40 cop[tikv] not(isnull(test_partition_1.t2.b))",
|
|
" │ └─IndexRangeScan 0.40 cop[tikv] table:t2, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [6 1,6 1], [6 6,6 6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 0.40 root partition:p0 index:Selection",
|
|
" └─Selection 0.40 cop[tikv] not(isnull(test_partition_1.t1.b))",
|
|
" └─IndexRangeScan 0.40 cop[tikv] table:t1, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select /*+ INL_JOIN(t2,t1) */ count(*) from t2 join t1 on t2.b = t1.b where t2.a in (1,2) and t1.a in (1,6) and t1.b in (1,6)",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 0.00 root inner join, equal:[eq(test_partition.t2.b, test_partition.t1.b)]",
|
|
" ├─TableReader(Build) 0.04 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 0.04 cop[tikv] in(test_partition.t1.a, 1, 6), in(test_partition.t1.b, 1, 6), not(isnull(test_partition.t1.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 0.04 root partition:p0 data:Selection",
|
|
" └─Selection 0.04 cop[tikv] in(test_partition.t2.a, 1, 2), in(test_partition.t2.b, 1, 6), not(isnull(test_partition.t2.b))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─IndexJoin 0.10 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.b, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.b)",
|
|
" ├─IndexReader(Build) 0.40 root partition:p0 index:Selection",
|
|
" │ └─Selection 0.40 cop[tikv] not(isnull(test_partition_1.t2.b))",
|
|
" │ └─IndexRangeScan 0.40 cop[tikv] table:t2, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 0.32 root partition:p0,p1 index:Selection",
|
|
" └─Selection 0.32 cop[tikv] in(test_partition_1.t1.b, 1, 6), not(isnull(test_partition_1.t1.b))",
|
|
" └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select /*+ INL_HASH_JOIN(t1,t2) */ count(*) from t2 join t1 on t2.b = t1.b where t2.a in (1,2) and t1.a in (1,6) and t1.b in (6,1)",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 0.00 root inner join, equal:[eq(test_partition.t2.b, test_partition.t1.b)]",
|
|
" ├─TableReader(Build) 0.04 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 0.04 cop[tikv] in(test_partition.t1.a, 1, 6), in(test_partition.t1.b, 6, 1), not(isnull(test_partition.t1.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 0.04 root partition:p0 data:Selection",
|
|
" └─Selection 0.04 cop[tikv] in(test_partition.t2.a, 1, 2), in(test_partition.t2.b, 6, 1), not(isnull(test_partition.t2.b))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─IndexHashJoin 0.10 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.b, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.b)",
|
|
" ├─IndexReader(Build) 0.40 root partition:p0 index:Selection",
|
|
" │ └─Selection 0.40 cop[tikv] not(isnull(test_partition_1.t2.b))",
|
|
" │ └─IndexRangeScan 0.40 cop[tikv] table:t2, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [2 1,2 1], [2 6,2 6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 0.32 root partition:p0,p1 index:Selection",
|
|
" └─Selection 0.32 cop[tikv] in(test_partition_1.t1.b, 6, 1), not(isnull(test_partition_1.t1.b))",
|
|
" └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select /*+ INL_HASH_JOIN(t1,t2) */ count(*) from t2 join t1 on t2.b = t1.b where t2.a in (1,2) and t1.a in (1,6) and t1.b in (100,9,6)",
|
|
"Result": [
|
|
"0"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 0.00 root inner join, equal:[eq(test_partition.t2.b, test_partition.t1.b)]",
|
|
" ├─TableReader(Build) 0.06 root partition:p1 data:Selection",
|
|
" │ └─Selection 0.06 cop[tikv] in(test_partition.t1.a, 1, 6), in(test_partition.t1.b, 100, 9, 6), not(isnull(test_partition.t1.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 0.06 root partition:dual data:Selection",
|
|
" └─Selection 0.06 cop[tikv] in(test_partition.t2.a, 1, 2), in(test_partition.t2.b, 100, 9, 6), not(isnull(test_partition.t2.b))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─IndexHashJoin 0.23 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.b, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.b)",
|
|
" ├─IndexReader(Build) 0.60 root partition:dual index:Selection",
|
|
" │ └─Selection 0.60 cop[tikv] not(isnull(test_partition_1.t2.b))",
|
|
" │ └─IndexRangeScan 0.60 cop[tikv] table:t2, index:a(a, b, id) range:[1 6,1 6], [1 9,1 9], [1 100,1 100], [2 6,2 6], [2 9,2 9], [2 100,2 100], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 0.48 root partition:p1 index:Selection",
|
|
" └─Selection 0.48 cop[tikv] in(test_partition_1.t1.b, 100, 9, 6), not(isnull(test_partition_1.t1.b))",
|
|
" └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select /*+ INL_HASH_JOIN(t1,t2) */ count(*) from t2 join t1 on t2.b = t1.b where t2.a in (1,2) and t1.a in (1,6) and t1.b in (100,9,6,1)",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 0.01 root inner join, equal:[eq(test_partition.t2.b, test_partition.t1.b)]",
|
|
" ├─TableReader(Build) 0.08 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 0.08 cop[tikv] in(test_partition.t1.a, 1, 6), in(test_partition.t1.b, 100, 9, 6, 1), not(isnull(test_partition.t1.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 0.08 root partition:p0 data:Selection",
|
|
" └─Selection 0.08 cop[tikv] in(test_partition.t2.a, 1, 2), in(test_partition.t2.b, 100, 9, 6, 1), not(isnull(test_partition.t2.b))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─IndexHashJoin 0.41 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.b, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.b)",
|
|
" ├─IndexReader(Build) 0.80 root partition:p0 index:Selection",
|
|
" │ └─Selection 0.80 cop[tikv] not(isnull(test_partition_1.t2.b))",
|
|
" │ └─IndexRangeScan 0.80 cop[tikv] table:t2, index:a(a, b, id) range:[1 1,1 1], [1 6,1 6], [1 9,1 9], [1 100,1 100], [2 1,2 1], [2 6,2 6], [2 9,2 9], [2 100,2 100], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 0.64 root partition:p0,p1 index:Selection",
|
|
" └─Selection 0.64 cop[tikv] in(test_partition_1.t1.b, 100, 9, 6, 1), not(isnull(test_partition_1.t1.b))",
|
|
" └─IndexRangeScan 160.00 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.b, test_partition_1.t2.b) in(test_partition_1.t1.a, 1, 6)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,2,3) union select * from t1 where b in (6,7,8) order by a",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8"
|
|
],
|
|
"Plan": [
|
|
"Sort 48.00 root Column#10",
|
|
"└─HashAgg 48.00 root group by:Column#10, Column#11, Column#9, funcs:firstrow(Column#9)->Column#9, funcs:firstrow(Column#10)->Column#10, funcs:firstrow(Column#11)->Column#11",
|
|
" └─Union 60.00 root ",
|
|
" ├─TableReader 30.00 root partition:p0 data:Selection",
|
|
" │ └─Selection 30.00 cop[tikv] in(test_partition.t1.a, 1, 2, 3)",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader 30.00 root partition:p1 data:Selection",
|
|
" └─Selection 30.00 cop[tikv] in(test_partition.t1.b, 6, 7, 8)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 48.00 root Column#10",
|
|
"└─HashAgg 48.00 root group by:Column#10, Column#11, Column#9, funcs:firstrow(Column#9)->Column#9, funcs:firstrow(Column#10)->Column#10, funcs:firstrow(Column#11)->Column#11",
|
|
" └─Union 60.00 root ",
|
|
" ├─IndexReader 30.00 root partition:p0 index:IndexRangeScan",
|
|
" │ └─IndexRangeScan 30.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,1], [2,2], [3,3], keep order:false, stats:pseudo",
|
|
" └─IndexReader 30.00 root partition:p1 index:Selection",
|
|
" └─Selection 30.00 cop[tikv] in(test_partition_1.t1.b, 6, 7, 8)",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a < 1 or b < 2",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 5542.21 root partition:p0 data:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(lt(test_partition.t1.a, 1), lt(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 5542.21 root partition:p0 index:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(lt(test_partition_1.t1.a, 1), lt(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select count(1) from t1 where a < 1 or b < 2",
|
|
"Result": [
|
|
"1"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(Column#7)->Column#5",
|
|
"└─TableReader 1.00 root partition:p0 data:StreamAgg",
|
|
" └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#7",
|
|
" └─Selection 5542.21 cop[tikv] or(lt(test_partition.t1.a, 1), lt(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(Column#10)->Column#5",
|
|
"└─IndexReader 1.00 root partition:p0 index:StreamAgg",
|
|
" └─StreamAgg 1.00 cop[tikv] funcs:count(1)->Column#10",
|
|
" └─Selection 5542.21 cop[tikv] or(lt(test_partition_1.t1.a, 1), lt(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a < 1 and b < 2",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 1104.45 root partition:dual data:Selection",
|
|
"└─Selection 1104.45 cop[tikv] lt(test_partition.t1.a, 1), lt(test_partition.t1.b, 2)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 1104.45 root partition:dual index:Selection",
|
|
"└─Selection 1104.45 cop[tikv] lt(test_partition_1.t1.b, 2)",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,1), keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a < 3 or b > 4",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"5 5 5",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9",
|
|
"10 10 10"
|
|
],
|
|
"Plan": [
|
|
"TableReader 5548.89 root partition:p0,p1 data:Selection",
|
|
"└─Selection 5548.89 cop[tikv] or(lt(test_partition.t1.a, 3), gt(test_partition.t1.b, 4))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 5548.89 root partition:p0,p1 index:Selection",
|
|
"└─Selection 5548.89 cop[tikv] or(lt(test_partition_1.t1.a, 3), gt(test_partition_1.t1.b, 4))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a < 3 and b > 4",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 1107.78 root partition:dual data:Selection",
|
|
"└─Selection 1107.78 cop[tikv] gt(test_partition.t1.b, 4), lt(test_partition.t1.a, 3)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 1107.78 root partition:dual index:Selection",
|
|
"└─Selection 1107.78 cop[tikv] gt(test_partition_1.t1.b, 4)",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3), keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a < 3 and b >= 3",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 1107.78 root partition:dual data:Selection",
|
|
"└─Selection 1107.78 cop[tikv] ge(test_partition.t1.b, 3), lt(test_partition.t1.a, 3)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 1107.78 root partition:dual index:Selection",
|
|
"└─Selection 1107.78 cop[tikv] ge(test_partition_1.t1.b, 3)",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3), keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a < 3 and (b >= 1 and b <= 3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 83.08 root partition:p0 data:Selection",
|
|
"└─Selection 83.08 cop[tikv] ge(test_partition.t1.b, 1), le(test_partition.t1.b, 3), lt(test_partition.t1.a, 3)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 83.08 root partition:p0 index:Selection",
|
|
"└─Selection 83.08 cop[tikv] ge(test_partition_1.t1.b, 1), le(test_partition_1.t1.b, 3)",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3), keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 3 or b <= 3",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3"
|
|
],
|
|
"Plan": [
|
|
"TableReader 5542.21 root partition:p0 data:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition.t1.a, 3), le(test_partition.t1.b, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 5542.21 root partition:p0 index:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition_1.t1.a, 3), le(test_partition_1.t1.b, 3))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where (a<=1 and b<=1) or (a >=6 and b>=6)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9",
|
|
"10 10 10"
|
|
],
|
|
"Plan": [
|
|
"TableReader 2092.85 root partition:p0,p1 data:Selection",
|
|
"└─Selection 2092.85 cop[tikv] or(and(le(test_partition.t1.a, 1), le(test_partition.t1.b, 1)), and(ge(test_partition.t1.a, 6), ge(test_partition.t1.b, 6)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 5325.33 root partition:p0,p1 index:Selection",
|
|
"└─Selection 5325.33 cop[tikv] or(and(le(test_partition_1.t1.a, 1), le(test_partition_1.t1.b, 1)), and(ge(test_partition_1.t1.a, 6), ge(test_partition_1.t1.b, 6)))",
|
|
" └─IndexRangeScan 6656.67 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,1], [6,+inf], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 100 and b <= 100",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9",
|
|
"10 10 10"
|
|
],
|
|
"Plan": [
|
|
"TableReader 1104.45 root partition:p0,p1 data:Selection",
|
|
"└─Selection 1104.45 cop[tikv] le(test_partition.t1.a, 100), le(test_partition.t1.b, 100)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 1104.45 root partition:p0,p1 index:Selection",
|
|
"└─Selection 1104.45 cop[tikv] le(test_partition_1.t1.b, 100)",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,100], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on t1.id = t2.id where (t1.a <= 3 and (t1.b >= 3 and t1.b <= 5)) and (t2.a >= 6 and t2.a <= 8) and t2.b>=7 and t2.id>=7",
|
|
"Result": null,
|
|
"Plan": [
|
|
"HashJoin 34.62 root inner join, equal:[eq(test_partition.t1.id, test_partition.t2.id)]",
|
|
"├─TableReader(Build) 27.69 root partition:p0 data:Selection",
|
|
"│ └─Selection 27.69 cop[tikv] ge(test_partition.t1.b, 3), ge(test_partition.t1.id, 7), le(test_partition.t1.a, 3), le(test_partition.t1.b, 5), not(isnull(test_partition.t1.id))",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 27.78 root partition:p1 data:Selection",
|
|
" └─Selection 27.78 cop[tikv] ge(test_partition.t2.a, 6), ge(test_partition.t2.b, 7), ge(test_partition.t2.id, 7), le(test_partition.t2.a, 8), not(isnull(test_partition.t2.id))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"HashJoin 34.62 root inner join, equal:[eq(test_partition_1.t1.id, test_partition_1.t2.id)]",
|
|
"├─IndexReader(Build) 27.69 root partition:p0 index:Selection",
|
|
"│ └─Selection 27.69 cop[tikv] ge(test_partition_1.t1.b, 3), ge(test_partition_1.t1.id, 7), le(test_partition_1.t1.b, 5), not(isnull(test_partition_1.t1.id))",
|
|
"│ └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo",
|
|
"└─IndexReader(Probe) 27.78 root partition:p1 index:Selection",
|
|
" └─Selection 27.78 cop[tikv] ge(test_partition_1.t2.b, 7), ge(test_partition_1.t2.id, 7), not(isnull(test_partition_1.t2.id))",
|
|
" └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[6,8], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 left join t2 on true where (t1.a <=1 or t1.a <= 3 and (t1.b >=3 and t1.b <= 5)) and (t2.a >= 6 and t2.a <= 8) and t2.b>=7 and t2.id>=7 order by t1.id,t1.a",
|
|
"Result": [
|
|
"1 1 1 8 8 8",
|
|
"1 1 1 7 7 7",
|
|
"3 3 3 8 8 8",
|
|
"3 3 3 7 7 7"
|
|
],
|
|
"Plan": [
|
|
"Sort 93855.70 root test_partition.t1.id, test_partition.t1.a",
|
|
"└─Projection 93855.70 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
" └─HashJoin 93855.70 root CARTESIAN inner join",
|
|
" ├─TableReader(Build) 27.78 root partition:p1 data:Selection",
|
|
" │ └─Selection 27.78 cop[tikv] ge(test_partition.t2.a, 6), ge(test_partition.t2.b, 7), ge(test_partition.t2.id, 7), le(test_partition.t2.a, 8)",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 3378.81 root partition:p0 data:Selection",
|
|
" └─Selection 3378.81 cop[tikv] or(le(test_partition.t1.a, 1), and(le(test_partition.t1.a, 3), and(ge(test_partition.t1.b, 3), le(test_partition.t1.b, 5))))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 73851.85 root test_partition_1.t1.id, test_partition_1.t1.a",
|
|
"└─Projection 73851.85 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t2.id, test_partition_1.t2.a, test_partition_1.t2.b",
|
|
" └─HashJoin 73851.85 root CARTESIAN inner join",
|
|
" ├─IndexReader(Build) 27.78 root partition:p1 index:Selection",
|
|
" │ └─Selection 27.78 cop[tikv] ge(test_partition_1.t2.b, 7), ge(test_partition_1.t2.id, 7)",
|
|
" │ └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[6,8], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 2658.67 root partition:p0 index:Selection",
|
|
" └─Selection 2658.67 cop[tikv] or(le(test_partition_1.t1.a, 1), and(le(test_partition_1.t1.a, 3), and(ge(test_partition_1.t1.b, 3), le(test_partition_1.t1.b, 5))))",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 3323.33 root partition:p0 data:Selection",
|
|
"└─Selection 3323.33 cop[tikv] le(test_partition.t1.a, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 3323.33 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where b <= 1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 3323.33 root partition:p0 data:Selection",
|
|
"└─Selection 3323.33 cop[tikv] le(test_partition.t1.b, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 3323.33 root partition:p0 index:Selection",
|
|
"└─Selection 3323.33 cop[tikv] le(test_partition_1.t1.b, 1)",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 1 or b <= 2",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 5542.21 root partition:p0 data:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition.t1.a, 1), le(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 5542.21 root partition:p0 index:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition_1.t1.a, 1), le(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 1 or (a <= 2 and b <= 2) or (a <= 5 or b <= 5)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5"
|
|
],
|
|
"Plan": [
|
|
"TableReader 6034.55 root partition:p0 data:Selection",
|
|
"└─Selection 6034.55 cop[tikv] or(or(le(test_partition.t1.a, 1), and(le(test_partition.t1.a, 2), le(test_partition.t1.b, 2))), or(le(test_partition.t1.a, 5), le(test_partition.t1.b, 5)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 6034.55 root partition:p0 index:Selection",
|
|
"└─Selection 6034.55 cop[tikv] or(or(le(test_partition_1.t1.a, 1), and(le(test_partition_1.t1.a, 2), le(test_partition_1.t1.b, 2))), or(le(test_partition_1.t1.a, 5), le(test_partition_1.t1.b, 5)))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 1 or (a is null and b >= 10)",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 3325.56 root partition:p0 data:Selection",
|
|
"└─Selection 3325.56 cop[tikv] or(le(test_partition.t1.a, 1), and(isnull(test_partition.t1.a), ge(test_partition.t1.b, 10)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 200.00 root partition:p0 index:Selection",
|
|
"└─Selection 200.00 cop[tikv] or(le(test_partition_1.t1.a, 1), and(isnull(test_partition_1.t1.a), ge(test_partition_1.t1.b, 10)))",
|
|
" └─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range:[NULL,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 1 or (a <= 10 and b is null)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"<nil> 10 <nil>"
|
|
],
|
|
"Plan": [
|
|
"TableReader 3325.55 root partition:p0,p1 data:Selection",
|
|
"└─Selection 3325.55 cop[tikv] or(le(test_partition.t1.a, 1), and(le(test_partition.t1.a, 10), isnull(test_partition.t1.b)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 2658.67 root partition:p0,p1 index:Selection",
|
|
"└─Selection 2658.67 cop[tikv] or(le(test_partition_1.t1.a, 1), and(le(test_partition_1.t1.a, 10), isnull(test_partition_1.t1.b)))",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,10], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 8 or b <= 9",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9"
|
|
],
|
|
"Plan": [
|
|
"TableReader 5542.21 root partition:p0,p1 data:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition.t1.a, 8), le(test_partition.t1.b, 9))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 5542.21 root partition:p0,p1 index:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition_1.t1.a, 8), le(test_partition_1.t1.b, 9))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 3 and false",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableDual 0.00 root rows:0"
|
|
],
|
|
"IndexPlan": [
|
|
"TableDual 0.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 3 and true",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3"
|
|
],
|
|
"Plan": [
|
|
"TableReader 3323.33 root partition:p0 data:Selection",
|
|
"└─Selection 3323.33 cop[tikv] le(test_partition.t1.a, 3)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 3323.33 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 3 or false",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3"
|
|
],
|
|
"Plan": [
|
|
"TableReader 3323.33 root partition:p0 data:Selection",
|
|
"└─Selection 3323.33 cop[tikv] or(le(test_partition.t1.a, 3), 0)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 3323.33 root partition:p0 index:IndexRangeScan",
|
|
"└─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 3 or true order by id,a",
|
|
"Result": [
|
|
"<nil> 10 <nil>",
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9",
|
|
"10 10 10"
|
|
],
|
|
"Plan": [
|
|
"Sort 10000.00 root test_partition.t1.id, test_partition.t1.a",
|
|
"└─TableReader 10000.00 root partition:all data:Selection",
|
|
" └─Selection 10000.00 cop[tikv] or(eq(test_partition.t1.a, 3), 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 10000.00 root test_partition_1.t1.id, test_partition_1.t1.a",
|
|
"└─IndexReader 10000.00 root partition:all index:IndexFullScan",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 3 or (b >= 100 and b <= 200)",
|
|
"Result": [
|
|
"3 3 3"
|
|
],
|
|
"Plan": [
|
|
"TableReader 259.75 root partition:p0 data:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition.t1.a, 3), and(ge(test_partition.t1.b, 100), le(test_partition.t1.b, 200)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 259.75 root partition:p0 index:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition_1.t1.a, 3), and(ge(test_partition_1.t1.b, 100), le(test_partition_1.t1.b, 200)))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 or b >= 1 and b <= 2",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 259.75 root partition:p0 data:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition.t1.a, 100), and(ge(test_partition.t1.b, 1), le(test_partition.t1.b, 2)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 259.75 root partition:p0 index:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition_1.t1.a, 100), and(ge(test_partition_1.t1.b, 1), le(test_partition_1.t1.b, 2)))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 or b >= 1 and b <= 6",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 259.75 root partition:p0,p1 data:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition.t1.a, 100), and(ge(test_partition.t1.b, 1), le(test_partition.t1.b, 6)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 259.75 root partition:p0,p1 index:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition_1.t1.a, 100), and(ge(test_partition_1.t1.b, 1), le(test_partition_1.t1.b, 6)))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 or (b >= 100 and b <= 200)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 259.75 root partition:dual data:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition.t1.a, 100), and(ge(test_partition.t1.b, 100), le(test_partition.t1.b, 200)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 259.75 root partition:dual index:Selection",
|
|
"└─Selection 259.75 cop[tikv] or(eq(test_partition_1.t1.a, 100), and(ge(test_partition_1.t1.b, 100), le(test_partition_1.t1.b, 200)))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where (a >= 1 and a <= 6) or (b >= 1 and b <= 2) or (a<=3 and b <=3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 1543.67 root partition:p0,p1 data:Selection",
|
|
"└─Selection 1543.67 cop[tikv] or(and(ge(test_partition.t1.a, 1), le(test_partition.t1.a, 6)), or(and(ge(test_partition.t1.b, 1), le(test_partition.t1.b, 2)), and(le(test_partition.t1.a, 3), le(test_partition.t1.b, 3))))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 1543.67 root partition:p0,p1 index:Selection",
|
|
"└─Selection 1543.67 cop[tikv] or(and(ge(test_partition_1.t1.a, 1), le(test_partition_1.t1.a, 6)), or(and(ge(test_partition_1.t1.b, 1), le(test_partition_1.t1.b, 2)), and(le(test_partition_1.t1.a, 3), le(test_partition_1.t1.b, 3))))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a >= 1 and a <= 6",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6"
|
|
],
|
|
"Plan": [
|
|
"TableReader 250.00 root partition:p0,p1 data:Selection",
|
|
"└─Selection 250.00 cop[tikv] ge(test_partition.t1.a, 1), le(test_partition.t1.a, 6)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 250.00 root partition:p0,p1 index:IndexRangeScan",
|
|
"└─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,6], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where (a >= 1 and a <= 6) or (a>=3 and b >=3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5",
|
|
"6 6 6",
|
|
"7 7 7",
|
|
"8 8 8",
|
|
"9 9 9",
|
|
"10 10 10"
|
|
],
|
|
"Plan": [
|
|
"TableReader 1333.33 root partition:p0,p1 data:Selection",
|
|
"└─Selection 1333.33 cop[tikv] or(and(ge(test_partition.t1.a, 1), le(test_partition.t1.a, 6)), and(ge(test_partition.t1.a, 3), ge(test_partition.t1.b, 3)))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 2666.67 root partition:p0,p1 index:Selection",
|
|
"└─Selection 2666.67 cop[tikv] or(and(ge(test_partition_1.t1.a, 1), le(test_partition_1.t1.a, 6)), and(ge(test_partition_1.t1.a, 3), ge(test_partition_1.t1.b, 3)))",
|
|
" └─IndexRangeScan 3333.33 cop[tikv] table:t1, index:a(a, b, id) range:[1,+inf], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a in (1,6) and (a=3 and b =3)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableDual 8000.00 root rows:0"
|
|
],
|
|
"IndexPlan": [
|
|
"TableDual 8000.00 root rows:0"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 1 and (b>=6 or a>=6)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 1846.30 root partition:dual data:Selection",
|
|
"└─Selection 1846.30 cop[tikv] le(test_partition.t1.a, 1), or(ge(test_partition.t1.b, 6), ge(test_partition.t1.a, 6))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 1846.30 root partition:dual index:Selection",
|
|
"└─Selection 1846.30 cop[tikv] or(ge(test_partition_1.t1.b, 6), ge(test_partition_1.t1.a, 6))",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a = 100 and (b<=200 or a<=200)",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 10.00 root partition:dual data:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 100), or(le(test_partition.t1.b, 200), 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 100.00 root partition:dual index:IndexRangeScan",
|
|
"└─IndexRangeScan 100.00 cop[tikv] table:t1, index:a(a, b, id) range:[100 NULL,100 +inf], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where a <= 5 or (a+b=3)",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2",
|
|
"3 3 3",
|
|
"4 4 4",
|
|
"5 5 5"
|
|
],
|
|
"Plan": [
|
|
"TableReader 8664.67 root partition:all data:Selection",
|
|
"└─Selection 8664.67 cop[tikv] or(le(test_partition.t1.a, 5), eq(plus(test_partition.t1.a, test_partition.t1.b), 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 8664.67 root partition:all index:Selection",
|
|
"└─Selection 8664.67 cop[tikv] or(le(test_partition_1.t1.a, 5), eq(plus(test_partition_1.t1.a, test_partition_1.t1.b), 3))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where id <= 1 or id<=2",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"TableReader 3323.33 root partition:all data:Selection",
|
|
"└─Selection 3323.33 cop[tikv] or(le(test_partition.t1.id, 1), le(test_partition.t1.id, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 3323.33 root partition:all index:Selection",
|
|
"└─Selection 3323.33 cop[tikv] or(le(test_partition_1.t1.id, 1), le(test_partition_1.t1.id, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where id <= 1 and a<=1",
|
|
"Result": [
|
|
"1 1 1"
|
|
],
|
|
"Plan": [
|
|
"TableReader 1104.45 root partition:p0 data:Selection",
|
|
"└─Selection 1104.45 cop[tikv] le(test_partition.t1.a, 1), le(test_partition.t1.id, 1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 1104.45 root partition:p0 index:Selection",
|
|
"└─Selection 1104.45 cop[tikv] le(test_partition_1.t1.id, 1)",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,1], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 partition(p1) where a <= 1 or b <= 2",
|
|
"Result": null,
|
|
"Plan": [
|
|
"TableReader 5542.21 root partition:dual data:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition.t1.a, 1), le(test_partition.t1.b, 2))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"IndexReader 5542.21 root partition:dual index:Selection",
|
|
"└─Selection 5542.21 cop[tikv] or(le(test_partition_1.t1.a, 1), le(test_partition_1.t1.b, 2))",
|
|
" └─IndexFullScan 10000.00 cop[tikv] table:t1, index:a(a, b, id) keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on t1.id = t2.id where (t1.a<=1 or t1.a <= 3) and (t2.a <= 6 and t2.b <= 6)",
|
|
"Result": [
|
|
"1 1 1 1 1 1",
|
|
"2 2 2 2 2 2",
|
|
"3 3 3 3 3 3"
|
|
],
|
|
"Plan": [
|
|
"Projection 1379.19 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
"└─HashJoin 1379.19 root inner join, equal:[eq(test_partition.t2.id, test_partition.t1.id)]",
|
|
" ├─TableReader(Build) 1103.35 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 1103.35 cop[tikv] le(test_partition.t2.a, 6), le(test_partition.t2.b, 6), not(isnull(test_partition.t2.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 3320.01 root partition:p0 data:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition.t1.id)), or(le(test_partition.t1.a, 1), le(test_partition.t1.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 1379.19 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t2.id, test_partition_1.t2.a, test_partition_1.t2.b",
|
|
"└─HashJoin 1379.19 root inner join, equal:[eq(test_partition_1.t2.id, test_partition_1.t1.id)]",
|
|
" ├─IndexReader(Build) 1103.35 root partition:p0,p1 index:Selection",
|
|
" │ └─Selection 1103.35 cop[tikv] le(test_partition_1.t2.b, 6), not(isnull(test_partition_1.t2.id))",
|
|
" │ └─IndexRangeScan 3323.33 cop[tikv] table:t2, index:a(a, b, id) range:[-inf,6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 3320.01 root partition:p0 index:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t1 as t2 on t1.id = t2.id where (t1.a<=1 or t1.a <= 3) and (t2.a <= 6 and t2.b <= 6)",
|
|
"Result": [
|
|
"1 1 1 1 1 1",
|
|
"2 2 2 2 2 2",
|
|
"3 3 3 3 3 3"
|
|
],
|
|
"Plan": [
|
|
"Projection 1379.19 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t1.id, test_partition.t1.a, test_partition.t1.b",
|
|
"└─HashJoin 1379.19 root inner join, equal:[eq(test_partition.t1.id, test_partition.t1.id)]",
|
|
" ├─TableReader(Build) 1103.35 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 1103.35 cop[tikv] le(test_partition.t1.a, 6), le(test_partition.t1.b, 6), not(isnull(test_partition.t1.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 3320.01 root partition:p0 data:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition.t1.id)), or(le(test_partition.t1.a, 1), le(test_partition.t1.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 1379.19 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b",
|
|
"└─HashJoin 1379.19 root inner join, equal:[eq(test_partition_1.t1.id, test_partition_1.t1.id)]",
|
|
" ├─IndexReader(Build) 1103.35 root partition:p0,p1 index:Selection",
|
|
" │ └─Selection 1103.35 cop[tikv] le(test_partition_1.t1.b, 6), not(isnull(test_partition_1.t1.id))",
|
|
" │ └─IndexRangeScan 3323.33 cop[tikv] table:t2, index:a(a, b, id) range:[-inf,6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 3320.01 root partition:p0 index:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where t1.a in (select b from t2 where a BETWEEN 1 AND 2) order by a",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"Sort 249.75 root test_partition.t1.a",
|
|
"└─HashJoin 249.75 root inner join, equal:[eq(test_partition.t2.b, test_partition.t1.a)]",
|
|
" ├─HashAgg(Build) 199.80 root group by:test_partition.t2.b, funcs:firstrow(test_partition.t2.b)->test_partition.t2.b",
|
|
" │ └─TableReader 199.80 root partition:p0 data:HashAgg",
|
|
" │ └─HashAgg 199.80 cop[tikv] group by:test_partition.t2.b, ",
|
|
" │ └─Selection 249.75 cop[tikv] ge(test_partition.t2.a, 1), le(test_partition.t2.a, 2), not(isnull(test_partition.t2.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 9990.00 root partition:p0,p1 data:Selection",
|
|
" └─Selection 9990.00 cop[tikv] not(isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 249.75 root test_partition_1.t1.a",
|
|
"└─IndexJoin 249.75 root inner join, inner:IndexReader, outer key:test_partition_1.t2.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t2.b, test_partition_1.t1.a)",
|
|
" ├─HashAgg(Build) 199.80 root group by:test_partition_1.t2.b, funcs:firstrow(test_partition_1.t2.b)->test_partition_1.t2.b",
|
|
" │ └─IndexReader 199.80 root partition:p0 index:HashAgg",
|
|
" │ └─HashAgg 199.80 cop[tikv] group by:test_partition_1.t2.b, ",
|
|
" │ └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t2.b))",
|
|
" │ └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[1,2], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection",
|
|
" └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))",
|
|
" └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t2.b)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 where t1.a in (select b from t1 where a BETWEEN 1 AND 2) order by a",
|
|
"Result": [
|
|
"1 1 1",
|
|
"2 2 2"
|
|
],
|
|
"Plan": [
|
|
"Sort 249.75 root test_partition.t1.a",
|
|
"└─HashJoin 249.75 root inner join, equal:[eq(test_partition.t1.b, test_partition.t1.a)]",
|
|
" ├─HashAgg(Build) 199.80 root group by:test_partition.t1.b, funcs:firstrow(test_partition.t1.b)->test_partition.t1.b",
|
|
" │ └─TableReader 199.80 root partition:p0 data:HashAgg",
|
|
" │ └─HashAgg 199.80 cop[tikv] group by:test_partition.t1.b, ",
|
|
" │ └─Selection 249.75 cop[tikv] ge(test_partition.t1.a, 1), le(test_partition.t1.a, 2), not(isnull(test_partition.t1.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 9990.00 root partition:p0,p1 data:Selection",
|
|
" └─Selection 9990.00 cop[tikv] not(isnull(test_partition.t1.a))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Sort 249.75 root test_partition_1.t1.a",
|
|
"└─IndexJoin 249.75 root inner join, inner:IndexReader, outer key:test_partition_1.t1.b, inner key:test_partition_1.t1.a, equal cond:eq(test_partition_1.t1.b, test_partition_1.t1.a)",
|
|
" ├─HashAgg(Build) 199.80 root group by:test_partition_1.t1.b, funcs:firstrow(test_partition_1.t1.b)->test_partition_1.t1.b",
|
|
" │ └─IndexReader 199.80 root partition:p0 index:HashAgg",
|
|
" │ └─HashAgg 199.80 cop[tikv] group by:test_partition_1.t1.b, ",
|
|
" │ └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t1.b))",
|
|
" │ └─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,2], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 1.25 root partition:p0,p1 index:Selection",
|
|
" └─Selection 1.25 cop[tikv] not(isnull(test_partition_1.t1.a))",
|
|
" └─IndexRangeScan 1.25 cop[tikv] table:t1, index:a(a, b, id) range: decided by [eq(test_partition_1.t1.a, test_partition_1.t1.b)], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 left join t2 on t1.id = t2.id where (t1.a<=1 or t1.a <= 3) and t2.a BETWEEN 6 AND 8",
|
|
"Result": null,
|
|
"Plan": [
|
|
"Projection 312.19 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
"└─HashJoin 312.19 root inner join, equal:[eq(test_partition.t2.id, test_partition.t1.id)]",
|
|
" ├─TableReader(Build) 249.75 root partition:p1 data:Selection",
|
|
" │ └─Selection 249.75 cop[tikv] ge(test_partition.t2.a, 6), le(test_partition.t2.a, 8), not(isnull(test_partition.t2.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 3320.01 root partition:p0 data:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition.t1.id)), or(le(test_partition.t1.a, 1), le(test_partition.t1.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 312.19 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t2.id, test_partition_1.t2.a, test_partition_1.t2.b",
|
|
"└─HashJoin 312.19 root inner join, equal:[eq(test_partition_1.t2.id, test_partition_1.t1.id)]",
|
|
" ├─IndexReader(Build) 249.75 root partition:p1 index:Selection",
|
|
" │ └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t2.id))",
|
|
" │ └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[6,8], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 3320.01 root partition:p0 index:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 right join t2 on t1.id = t2.id where (t1.a<=1 or t1.a <= 3) and t2.a BETWEEN 1 AND 3",
|
|
"Result": [
|
|
"1 1 1 1 1 1",
|
|
"2 2 2 2 2 2",
|
|
"3 3 3 3 3 3"
|
|
],
|
|
"Plan": [
|
|
"Projection 312.19 root test_partition.t1.id, test_partition.t1.a, test_partition.t1.b, test_partition.t2.id, test_partition.t2.a, test_partition.t2.b",
|
|
"└─HashJoin 312.19 root inner join, equal:[eq(test_partition.t2.id, test_partition.t1.id)]",
|
|
" ├─TableReader(Build) 249.75 root partition:p0 data:Selection",
|
|
" │ └─Selection 249.75 cop[tikv] ge(test_partition.t2.a, 1), le(test_partition.t2.a, 3), not(isnull(test_partition.t2.id))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 3320.01 root partition:p0 data:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition.t1.id)), or(le(test_partition.t1.a, 1), le(test_partition.t1.a, 3))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"Projection 312.19 root test_partition_1.t1.id, test_partition_1.t1.a, test_partition_1.t1.b, test_partition_1.t2.id, test_partition_1.t2.a, test_partition_1.t2.b",
|
|
"└─HashJoin 312.19 root inner join, equal:[eq(test_partition_1.t2.id, test_partition_1.t1.id)]",
|
|
" ├─IndexReader(Build) 249.75 root partition:p0 index:Selection",
|
|
" │ └─Selection 249.75 cop[tikv] not(isnull(test_partition_1.t2.id))",
|
|
" │ └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[1,3], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 3320.01 root partition:p0 index:Selection",
|
|
" └─Selection 3320.01 cop[tikv] not(isnull(test_partition_1.t1.id))",
|
|
" └─IndexRangeScan 3323.33 cop[tikv] table:t1, index:a(a, b, id) range:[-inf,3], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select * from t1 join t2 on true where t1.a=5 and t2.a BETWEEN 6 AND 8 and t2.b >= 6",
|
|
"Result": [
|
|
"5 5 5 6 6 6",
|
|
"5 5 5 7 7 7",
|
|
"5 5 5 8 8 8"
|
|
],
|
|
"Plan": [
|
|
"HashJoin 833.33 root CARTESIAN inner join",
|
|
"├─TableReader(Build) 10.00 root partition:p0 data:Selection",
|
|
"│ └─Selection 10.00 cop[tikv] eq(test_partition.t1.a, 5)",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
"└─TableReader(Probe) 83.33 root partition:p1 data:Selection",
|
|
" └─Selection 83.33 cop[tikv] ge(test_partition.t2.a, 6), ge(test_partition.t2.b, 6), le(test_partition.t2.a, 8)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"HashJoin 833.33 root CARTESIAN inner join",
|
|
"├─IndexReader(Build) 10.00 root partition:p0 index:IndexRangeScan",
|
|
"│ └─IndexRangeScan 10.00 cop[tikv] table:t1, index:a(a, b, id) range:[5,5], keep order:false, stats:pseudo",
|
|
"└─IndexReader(Probe) 83.33 root partition:p1 index:Selection",
|
|
" └─Selection 83.33 cop[tikv] ge(test_partition_1.t2.b, 6)",
|
|
" └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[6,8], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select count(*) from t1 join t2 on t1.b = t2.b where t1.a BETWEEN 1 AND 2 and t2.a BETWEEN 1 AND 6 and t1.b BETWEEN 1 AND 6",
|
|
"Result": [
|
|
"2"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 7.81 root inner join, equal:[eq(test_partition.t1.b, test_partition.t2.b)]",
|
|
" ├─TableReader(Build) 6.25 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 6.25 cop[tikv] ge(test_partition.t2.a, 1), ge(test_partition.t2.b, 1), le(test_partition.t2.a, 6), le(test_partition.t2.b, 6), not(isnull(test_partition.t2.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 6.25 root partition:p0 data:Selection",
|
|
" └─Selection 6.25 cop[tikv] ge(test_partition.t1.a, 1), ge(test_partition.t1.b, 1), le(test_partition.t1.a, 2), le(test_partition.t1.b, 6), not(isnull(test_partition.t1.b))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 7.81 root inner join, equal:[eq(test_partition_1.t1.b, test_partition_1.t2.b)]",
|
|
" ├─IndexReader(Build) 6.25 root partition:p0,p1 index:Selection",
|
|
" │ └─Selection 6.25 cop[tikv] ge(test_partition_1.t2.b, 1), le(test_partition_1.t2.b, 6), not(isnull(test_partition_1.t2.b))",
|
|
" │ └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[1,6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 6.25 root partition:p0 index:Selection",
|
|
" └─Selection 6.25 cop[tikv] ge(test_partition_1.t1.b, 1), le(test_partition_1.t1.b, 6), not(isnull(test_partition_1.t1.b))",
|
|
" └─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,2], keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "select /*+ INL_JOIN(t2,t1) */ count(*) from t2 join t1 on t2.b = t1.b where t2.a BETWEEN 1 AND 2 and t1.a BETWEEN 1 AND 6 and t1.b BETWEEN 1 AND 6",
|
|
"Result": [
|
|
"2"
|
|
],
|
|
"Plan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 7.81 root inner join, equal:[eq(test_partition.t2.b, test_partition.t1.b)]",
|
|
" ├─TableReader(Build) 6.25 root partition:p0,p1 data:Selection",
|
|
" │ └─Selection 6.25 cop[tikv] ge(test_partition.t1.a, 1), ge(test_partition.t1.b, 1), le(test_partition.t1.a, 6), le(test_partition.t1.b, 6), not(isnull(test_partition.t1.b))",
|
|
" │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo",
|
|
" └─TableReader(Probe) 6.25 root partition:p0 data:Selection",
|
|
" └─Selection 6.25 cop[tikv] ge(test_partition.t2.a, 1), ge(test_partition.t2.b, 1), le(test_partition.t2.a, 2), le(test_partition.t2.b, 6), not(isnull(test_partition.t2.b))",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo"
|
|
],
|
|
"IndexPlan": [
|
|
"StreamAgg 1.00 root funcs:count(1)->Column#9",
|
|
"└─HashJoin 7.81 root inner join, equal:[eq(test_partition_1.t2.b, test_partition_1.t1.b)]",
|
|
" ├─IndexReader(Build) 6.25 root partition:p0,p1 index:Selection",
|
|
" │ └─Selection 6.25 cop[tikv] ge(test_partition_1.t1.b, 1), le(test_partition_1.t1.b, 6), not(isnull(test_partition_1.t1.b))",
|
|
" │ └─IndexRangeScan 250.00 cop[tikv] table:t1, index:a(a, b, id) range:[1,6], keep order:false, stats:pseudo",
|
|
" └─IndexReader(Probe) 6.25 root partition:p0 index:Selection",
|
|
" └─Selection 6.25 cop[tikv] ge(test_partition_1.t2.b, 1), le(test_partition_1.t2.b, 6), not(isnull(test_partition_1.t2.b))",
|
|
" └─IndexRangeScan 250.00 cop[tikv] table:t2, index:a(a, b, id) range:[1,2], keep order:false, stats:pseudo"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"Name": "TestRangePartitionPredicatePruner",
|
|
"Cases": [
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t where a = 1",
|
|
"Result": [
|
|
"TableReader 10000.00 root data:TableFullScan",
|
|
"└─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t where a = 2",
|
|
"Result": [
|
|
"TableReader 10000.00 root data:TableFullScan",
|
|
"└─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t where a = 10",
|
|
"Result": [
|
|
"TableReader 10.00 root data:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition.t.a, 10)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t, partition:p_max keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t where a = -1",
|
|
"Result": [
|
|
"TableReader 10.00 root data:Selection",
|
|
"└─Selection 10.00 cop[tikv] eq(test_partition.t.a, -1)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t where a is NULL",
|
|
"Result": [
|
|
"TableReader 10.00 root data:Selection",
|
|
"└─Selection 10.00 cop[tikv] isnull(test_partition.t.a)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t where a = 1.5",
|
|
"Result": [
|
|
"PartitionUnion 32000.00 root ",
|
|
"├─TableReader 8000.00 root data:Selection",
|
|
"│ └─Selection 8000.00 cop[tikv] eq(cast(test_partition.t.a, decimal(20,0) BINARY), 1.5)",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p0 keep order:false, stats:pseudo",
|
|
"├─TableReader 8000.00 root data:Selection",
|
|
"│ └─Selection 8000.00 cop[tikv] eq(cast(test_partition.t.a, decimal(20,0) BINARY), 1.5)",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p1 keep order:false, stats:pseudo",
|
|
"├─TableReader 8000.00 root data:Selection",
|
|
"│ └─Selection 8000.00 cop[tikv] eq(cast(test_partition.t.a, decimal(20,0) BINARY), 1.5)",
|
|
"│ └─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo",
|
|
"└─TableReader 8000.00 root data:Selection",
|
|
" └─Selection 8000.00 cop[tikv] eq(cast(test_partition.t.a, decimal(20,0) BINARY), 1.5)",
|
|
" └─TableFullScan 10000.00 cop[tikv] table:t, partition:p_max keep order:false, stats:pseudo"
|
|
]
|
|
},
|
|
{
|
|
"SQL": "explain format = 'brief' select * from t where a in (2)",
|
|
"Result": [
|
|
"TableReader 10000.00 root data:TableFullScan",
|
|
"└─TableFullScan 10000.00 cop[tikv] table:t, partition:p2 keep order:false, stats:pseudo"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|