Skip to content

Instantly share code, notes, and snippets.

@ryogrid
Created September 24, 2023 03:25
Show Gist options
  • Save ryogrid/a1411ad782ac4c452c93f72c3a58d8b4 to your computer and use it in GitHub Desktop.
Save ryogrid/a1411ad782ac4c452c93f72c3a58d8b4 to your computer and use it in GitHub Desktop.
result of unittest of Optimizer (Selinger) 230922_1225
=== 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, ]
==================================================
values of first row: 2(4),
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
==================================================
values of first row: 32(4), 41.9(7),
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
==================================================
values of first row: 3(4), 3.2(7), d3-3(8), 16(4),
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
==================================================
values of first row: 3(4), 3.2(7), d3-3(8), 16(4),
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, ]
==================================================
values of first row: c2-0(8), 0(4), d3-0(8),
row num of execution result: 100
Pattern Name: Join(IndexJoin)
[ select Sc3.e2, Sc4.c1, Sc4.c2 from Sc3, Sc4 where Sc3.e1 = Sc4.c3; ]
==================================================
ProjectionPlanNode [sc3.e2, sc4.c1, sc4.c2, ]
IndexJoinPlanNode [sc3.e1 = sc4.c3]
SeqScanPlanNode [sc3.e1, sc3.e2, ]
==================================================
values of first row: 54.4(7), 2(4), 2(8),
row num of execution result: 20
Pattern Name: JoinAndIndexScan(HashJoin)
[ select Sc3.e2, Sc4.c1, Sc4.c2 from Sc3, Sc4 where Sc3.e1 = Sc4.c3 and Sc4.c3 = 5; ]
==================================================
ProjectionPlanNode [sc3.e2, sc4.c1, sc4.c2, ]
HashJoinPlanNode [sc3.e1 = sc4.c3]
SeqScanPlanNode [sc3.e1, sc3.e2, ]
RangeScanWithIndexPlanNode [sc4.c1, sc4.c2, sc4.c3, ] type:4 start:5 end:5
==================================================
values of first row: 58.4(7), 6(4), 2(8),
row num of execution result: 1
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 [sc3.e1 = sc2.d1]
SeqScanPlanNode [sc3.e1, sc3.e2, ]
HashJoinPlanNode [sc1.c1 = sc2.d1]
ProjectionPlanNode [sc1.c1, sc1.c2, ]
SeqScanPlanNode [sc1.c1, sc1.c2, sc1.c3, ]
ProjectionPlanNode [sc2.d1, ]
SeqScanPlanNode [sc2.d1, sc2.d2, sc2.d3, sc2.d4, ]
==================================================
values of first row: c2-1(8), 1(4), 54.4(7),
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, ]
==================================================
values of first row: 2(4), c2-2(8), 0(4), 0.2(7), d3-0(8),
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, ]
ProjectionPlanNode [sc4.c1, sc4.c2, ]
SelectionPlanNode [ colIndex:0 2 = ]
SeqScanPlanNode [sc4.c1, sc4.c2, sc4.c3, ]
==================================================
values of first row: 2(4), c2-2(8), 11.9(7), 2(4), 2(8),
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