Skip to content

Instantly share code, notes, and snippets.

@ryogrid
Created September 23, 2023 09:26
Show Gist options
  • Save ryogrid/c2a91ea8971f746ce4403689c0e9e64b to your computer and use it in GitHub Desktop.
Save ryogrid/c2a91ea8971f746ce4403689c0e9e64b to your computer and use it in GitHub Desktop.
passed optimization patterns 20230923_1825
=== RUN TestSimplePlanOptimization
System logging is active.
Pattern Name: Simple(SequentialScan)
[ select Sc1.c1 from Sc1 where Sc1.c1 = 2; ]
==================================================
ProjectionPlanNode [sc1.c1, ]
ProjectionPlanNode [sc1.c1, ]
SelectionPlanNode [ colIndex:0 2 = ]
SeqScanPlanNode [sc1.c1, sc1.c2, sc1.c3, ]
==================================================
row num of execution result: 1
Pattern Name: IndexScan
[ select Sc1.c1, Sc1.c3 from Sc1 where Sc1.c2 = 'c2-32'; ]
==================================================
ProjectionPlanNode [sc1.c1, sc1.c3, ]
RangeScanWithIndexPlanNode [sc1.c1, sc1.c2, sc1.c3, ] type:8 start:c2-32 end:c2-32
==================================================
row num of execution result: 1
Pattern Name: IndexScanInclude(1)
[ select Sc2.d1, Sc2.d2, Sc2.d3, Sc2.d4 from Sc2 where Sc2.d3 >= 'd3-3' and Sc2.d3 <= 'd3-5'; ]
==================================================
ProjectionPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ]
RangeScanWithIndexPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ] type:8 start:d3-3 end:d3-5
==================================================
row num of execution result: 60
Pattern Name: IndexScanInclude(2)
[ select Sc2.d1, Sc2.d2, Sc2.d3, Sc2.d4 from Sc2 where Sc2.d3 >= 'd3-3' and Sc2.d3 < 'd3-5'; ]
==================================================
ProjectionPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ]
SelectionPlanNode [ colIndex:2 d3-5 < colIndex:2 d3-3 >= AND ]
RangeScanWithIndexPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ] type:8 start:d3-3 end:d3-5
==================================================
row num of execution result: 40
Pattern Name: Join(HashJoin)
[ select Sc1.c2, Sc2.d1, Sc2.d3 from Sc1, Sc2 where Sc1.c1 = Sc2.d1; ]
==================================================
ProjectionPlanNode [sc1.c2, sc2.d1, sc2.d3, ]
HashJoinPlanNode [sc1.c1 = sc2.d1]
ProjectionPlanNode [sc1.c1, sc1.c2, ]
SeqScanPlanNode [sc1.c1, sc1.c2, sc1.c3, ]
ProjectionPlanNode [sc2.d1, sc2.d3, ]
SeqScanPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ]
==================================================
row num of execution result: 100
NewHashJoinPlanNodeWithChilds supports only one key for left and right now.
NewHashJoinPlanNodeWithChilds supports only one key for left and right now.
NewHashJoinPlanNodeWithChilds supports only one key for left and right now.
NewHashJoinPlanNodeWithChilds supports only one key for left and right now.
Pattern Name: ThreeJoin(HashJoin)
[ select Sc1.c2, Sc2.d1, Sc3.e2 from Sc1, Sc2, Sc3 where Sc1.c1 = Sc2.d1 and Sc2.d1 = Sc3.e1; ]
==================================================
ProjectionPlanNode [sc1.c2, sc2.d1, sc3.e2, ]
HashJoinPlanNode [sc1.c1 = sc2.d1]
ProjectionPlanNode [sc1.c1, sc1.c2, ]
SeqScanPlanNode [sc1.c1, sc1.c2, sc1.c3, ]
HashJoinPlanNode [sc2.d1 = sc3.e1]
ProjectionPlanNode [sc2.d1, ]
SeqScanPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ]
SeqScanPlanNode [sc3.e1, sc3.e2, ]
==================================================
row num of execution result: 20
Pattern Name: JoinWhere(NestedLoopJoin)
[ select Sc1.c1, Sc1.c2, Sc2.d1, Sc2.d2, Sc2.d3 from Sc1, Sc2 where Sc1.c1 = 2; ]
==================================================
ProjectionPlanNode [sc1.c1, sc1.c2, sc2.d1, sc2.d2, sc2.d3, ]
NestedLoopJoinPlanNode
ProjectionPlanNode [sc1.c1, sc1.c2, ]
SelectionPlanNode [ colIndex:0 2 = ]
SeqScanPlanNode [sc1.c1, sc1.c2, sc1.c3, ]
ProjectionPlanNode [sc2.d1, sc2.d2, sc2.d3, ]
SeqScanPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ]
==================================================
row num of execution result: 200
Pattern Name: SameNameColumn
[ select Sc1.c1, Sc1.c2, Sc1.c3, Sc4.c1, Sc4.c2 from Sc1, Sc4 where Sc1.c1 = Sc4.c1 and Sc4.c1 = 2; ]
==================================================
ProjectionPlanNode [sc1.c1, sc1.c2, sc1.c3, sc4.c1, sc4.c2, ]
HashJoinPlanNode [sc1.c1 = sc4.c1]
SeqScanPlanNode [sc1.c1, sc1.c2, sc1.c3, ]
SelectionPlanNode [ colIndex:0 2 = ]
SeqScanPlanNode [sc4.c1, sc4.c2, ]
==================================================
row num of execution result: 1
--- PASS: TestSimplePlanOptimization (0.05s)
PASS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment