Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

CHbenchmark Q2 Performance #1598

Open
lmwnshn opened this issue May 27, 2021 · 0 comments
Open

CHbenchmark Q2 Performance #1598

lmwnshn opened this issue May 27, 2021 · 0 comments
Labels
performance Performance related issues or changes.

Comments

@lmwnshn
Copy link
Contributor

lmwnshn commented May 27, 2021

With 0 tuples loaded, only schemas created, CHBenchmark Q2 takes a long time to execute (debug mode):

noisepage=# \pset pager off
Pager usage is off.
noisepage=# \timing on
Timing is on.
noisepage=# SELECT su_suppkey,
       su_name,
       n_name,
       i_id,
       i_name,
       su_address,
       su_phone,
       su_comment
FROM item, supplier, stock, nation, region,
  (SELECT s_i_id AS m_i_id, MIN (s_quantity) AS m_s_quantity
   FROM stock,
        supplier,
        nation,
        region
   WHERE MOD ((s_w_id*s_i_id), 10000)=su_suppkey
     AND su_nationkey=n_nationkey
     AND n_regionkey=r_regionkey
     AND r_name LIKE 'Europ%'
   GROUP BY s_i_id) m
WHERE i_id = s_i_id
  AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey
  AND su_nationkey = n_nationkey
  AND n_regionkey = r_regionkey
  AND i_data LIKE '%b'
  AND r_name LIKE 'Europ%'
  AND i_id=m_i_id
  AND s_quantity = m_s_quantity
ORDER BY n_name,
         su_name,
         i_id;
 su_suppkey | su_name | n_name | i_id | i_name | su_address | su_phone | su_comment 
------------+---------+--------+------+--------+------------+----------+------------
(0 rows)

Time: 4692.921 ms (00:04.693)
noisepage=# explain (format tpl) SELECT su_suppkey,
       su_name,
       n_name,
       i_id,
       i_name,
       su_address,
       su_phone,
       su_comment
FROM item, supplier, stock, nation, region,
  (SELECT s_i_id AS m_i_id, MIN (s_quantity) AS m_s_quantity
   FROM stock,
        supplier,
        nation,
        region
   WHERE MOD ((s_w_id*s_i_id), 10000)=su_suppkey
     AND su_nationkey=n_nationkey
     AND n_regionkey=r_regionkey
     AND r_name LIKE 'Europ%'
   GROUP BY s_i_id) m
WHERE i_id = s_i_id
  AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey
  AND su_nationkey = n_nationkey
  AND n_regionkey = r_regionkey
  AND i_data LIKE '%b'
  AND r_name LIKE 'Europ%'
  AND i_id=m_i_id
  AND s_quantity = m_s_quantity
ORDER BY n_name,
         su_name,
         i_id;
                                                                                                     QUERY PLAN                                                                                                      
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 struct AggPayload {                                                                                                                                                                                                +
     gb_term_attr0 : Integer                                                                                                                                                                                        +
     agg_term_attr0: IntegerMinAggregate                                                                                                                                                                            +
 }                                                                                                                                                                                                                  +
 struct AggValues {                                                                                                                                                                                                 +
     gb_term_attr0 : Integer                                                                                                                                                                                        +
     agg_term_attr0: Integer                                                                                                                                                                                        +
 }                                                                                                                                                                                                                  +
 struct QueryState {                                                                                                                                                                                                +
     execCtx     : *ExecutionContext                                                                                                                                                                                +
     aggHashTable: AggregationHashTable                                                                                                                                                                             +
 }                                                                                                                                                                                                                  +
 struct P2_State {                                                                                                                                                                                                  +
     tviBase4      : TableVectorIterator                                                                                                                                                                            +
     tviNeedsFree4 : bool                                                                                                                                                                                           +
     tviBase5      : TableVectorIterator                                                                                                                                                                            +
     tviNeedsFree5 : bool                                                                                                                                                                                           +
     filterManager2: FilterManager                                                                                                                                                                                  +
     tviBase6      : TableVectorIterator                                                                                                                                                                            +
     tviNeedsFree6 : bool                                                                                                                                                                                           +
     aggHashTable1 : AggregationHashTable                                                                                                                                                                           +
 }                                                                                                                                                                                                                  +
 struct P1_State {                                                                                                                                                                                                  +
     tviBase       : TableVectorIterator                                                                                                                                                                            +
     tviNeedsFree  : bool                                                                                                                                                                                           +
     filterManager : FilterManager                                                                                                                                                                                  +
     tviBase1      : TableVectorIterator                                                                                                                                                                            +
     tviNeedsFree1 : bool                                                                                                                                                                                           +
     tviBase2      : TableVectorIterator                                                                                                                                                                            +
     tviNeedsFree2 : bool                                                                                                                                                                                           +
     filterManager1: FilterManager                                                                                                                                                                                  +
     tviBase3      : TableVectorIterator                                                                                                                                                                            +
     tviNeedsFree3 : bool                                                                                                                                                                                           +
 }                                                                                                                                                                                                                  +
 fun Query3_Pipeline1_KeyCheckPartial(lhs: *AggPayload, rhs: *AggPayload) -> bool {                                                                                                                                 +
     if (SqlBoolToBool(lhs.gb_term_attr0 != rhs.gb_term_attr0)) {                                                                                                                                                   +
         return false                                                                                                                                                                                               +
     }                                                                                                                                                                                                              +
     return true                                                                                                                                                                                                    +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_MergePartitions(queryState: *QueryState, aggHashTable: *AggregationHashTable, ahtOvfIter: *AHTOverflowPartitionIterator) -> nil {                                                             +
     for (; @aggPartIterHasNext(ahtOvfIter); @aggPartIterNext(ahtOvfIter)) {                                                                                                                                        +
         var hashVal = @aggPartIterGetHash(ahtOvfIter)                                                                                                                                                              +
         var partialRow = @ptrCast(*AggPayload, @aggPartIterGetRow(ahtOvfIter))                                                                                                                                     +
         var aggPayload = @ptrCast(*AggPayload, @aggHTLookup(aggHashTable, hashVal, Query3_Pipeline1_KeyCheckPartial, partialRow))                                                                                  +
         if (aggPayload == nil) {                                                                                                                                                                                   +
             @aggHTLink(aggHashTable, @aggPartIterGetRowEntry(ahtOvfIter))                                                                                                                                          +
         } else {                                                                                                                                                                                                   +
             @aggMerge(&aggPayload.agg_term_attr0, &partialRow.agg_term_attr0)                                                                                                                                      +
         }                                                                                                                                                                                                          +
     }                                                                                                                                                                                                              +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_KeyCheck(aggPayload: *AggPayload, aggValues: *AggValues) -> bool {                                                                                                                            +
     if (SqlBoolToBool(aggPayload.gb_term_attr0 != aggValues.gb_term_attr0)) {                                                                                                                                      +
         return false                                                                                                                                                                                               +
     }                                                                                                                                                                                                              +
     return true                                                                                                                                                                                                    +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_FilterClause(execCtx: *ExecutionContext, vp: *VectorProjection, tids: *TupleIdList, context: *uint8) -> nil {                                                                                 +
     @filterLike(execCtx, vp, 0, @stringToSql("%b"), tids)                                                                                                                                                          +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_FilterClause1(execCtx: *ExecutionContext, vp: *VectorProjection, tids: *TupleIdList, context: *uint8) -> nil {                                                                                +
     @filterLike(execCtx, vp, 0, @stringToSql("Europ%"), tids)                                                                                                                                                      +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline2_FilterClause(execCtx: *ExecutionContext, vp: *VectorProjection, tids: *TupleIdList, context: *uint8) -> nil {                                                                                 +
     @filterLike(execCtx, vp, 0, @stringToSql("Europ%"), tids)                                                                                                                                                      +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Init(queryState: *QueryState) -> nil {                                                                                                                                                                  +
     @aggHTInit(&queryState.aggHashTable, queryState.execCtx, @sizeOf(AggPayload))                                                                                                                                  +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline2_InitPipelineState(queryState: *QueryState, pipelineState: *P2_State) -> nil {                                                                                                                 +
     @aggHTInit(&pipelineState.aggHashTable1, queryState.execCtx, @sizeOf(AggPayload))                                                                                                                              +
     @filterManagerInit(&pipelineState.filterManager2, queryState.execCtx)                                                                                                                                          +
     @filterManagerInsertFilter(&pipelineState.filterManager2, Query3_Pipeline2_FilterClause)                                                                                                                       +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline2_TearDownPipelineState(queryState: *QueryState, pipelineState: *P2_State) -> nil {                                                                                                             +
     @aggHTFree(&pipelineState.aggHashTable1)                                                                                                                                                                       +
     if (pipelineState.tviNeedsFree4) {                                                                                                                                                                             +
         @tableIterClose(&pipelineState.tviBase4)                                                                                                                                                                   +
         pipelineState.tviNeedsFree4 = false                                                                                                                                                                        +
     }                                                                                                                                                                                                              +
     if (pipelineState.tviNeedsFree5) {                                                                                                                                                                             +
         @tableIterClose(&pipelineState.tviBase5)                                                                                                                                                                   +
         pipelineState.tviNeedsFree5 = false                                                                                                                                                                        +
     }                                                                                                                                                                                                              +
     @filterManagerFree(&pipelineState.filterManager2)                                                                                                                                                              +
     if (pipelineState.tviNeedsFree6) {                                                                                                                                                                             +
         @tableIterClose(&pipelineState.tviBase6)                                                                                                                                                                   +
         pipelineState.tviNeedsFree6 = false                                                                                                                                                                        +
     }                                                                                                                                                                                                              +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline2_ParallelWork(queryState: *QueryState, pipelineState: *P2_State, tvi6: *TableVectorIterator) -> nil {                                                                                          +
     var slot8: TupleSlot                                                                                                                                                                                           +
     for (@tableIterAdvance(tvi6)) {                                                                                                                                                                                +
         var vpi6 = @tableIterGetVPI(tvi6)                                                                                                                                                                          +
         @filterManagerRunFilters(&pipelineState.filterManager2, vpi6, queryState.execCtx)                                                                                                                          +
         for (; @vpiHasNextFiltered(vpi6); @vpiAdvanceFiltered(vpi6)) {                                                                                                                                             +
             slot8 = @vpiGetSlot(vpi6)                                                                                                                                                                              +
             var tvi5 = &pipelineState.tviBase5                                                                                                                                                                     +
             var col_oids7: [2]uint32                                                                                                                                                                               +
             col_oids7[0] = 4                                                                                                                                                                                       +
             col_oids7[1] = 1                                                                                                                                                                                       +
             @tableIterInit(tvi5, queryState.execCtx, 1092, col_oids7)                                                                                                                                              +
             pipelineState.tviNeedsFree5 = true                                                                                                                                                                     +
             var slot7: TupleSlot                                                                                                                                                                                   +
             for (@tableIterAdvance(tvi5)) {                                                                                                                                                                        +
                 var vpi5 = @tableIterGetVPI(tvi5)                                                                                                                                                                  +
                 for (; @vpiHasNext(vpi5); @vpiAdvance(vpi5)) {                                                                                                                                                     +
                     slot7 = @vpiGetSlot(vpi5)                                                                                                                                                                      +
                     var tvi4 = &pipelineState.tviBase4                                                                                                                                                             +
                     var col_oids6: [3]uint32                                                                                                                                                                       +
                     col_oids6[0] = 3                                                                                                                                                                               +
                     col_oids6[1] = 2                                                                                                                                                                               +
                     col_oids6[2] = 1                                                                                                                                                                               +
                     @tableIterInit(tvi4, queryState.execCtx, 1072, col_oids6)                                                                                                                                      +
                     pipelineState.tviNeedsFree4 = true                                                                                                                                                             +
                     var slot6: TupleSlot                                                                                                                                                                           +
                     for (@tableIterAdvance(tvi4)) {                                                                                                                                                                +
                         var vpi4 = @tableIterGetVPI(tvi4)                                                                                                                                                          +
                         for (; @vpiHasNext(vpi4); @vpiAdvance(vpi4)) {                                                                                                                                             +
                             slot6 = @vpiGetSlot(vpi4)                                                                                                                                                              +
                             if (SqlBoolToBool(@mod(@vpiGetInt(vpi4, 2) * @vpiGetInt(vpi4, 1), @intToSql(10000)) == @vpiGetInt(vpi5, 1))) {                                                                         +
                                 var col_oids5: [2]uint32                                                                                                                                                           +
                                 col_oids5[0] = 3                                                                                                                                                                   +
                                 col_oids5[1] = 1                                                                                                                                                                   +
                                 var index_iter1: IndexIterator                                                                                                                                                     +
                                 @indexIteratorInit(&index_iter1, queryState.execCtx, 1, 1090, 1091, col_oids5)                                                                                                     +
                                 var lo_index_pr1 = @indexIteratorGetLoPR(&index_iter1)                                                                                                                             +
                                 var hi_index_pr1 = @indexIteratorGetHiPR(&index_iter1)                                                                                                                             +
                                 @prSetInt(lo_index_pr1, 0, @vpiGetInt(vpi5, 0))                                                                                                                                    +
                                 @prSetInt(hi_index_pr1, 0, @vpiGetInt(vpi5, 0))                                                                                                                                    +
                                 for (@indexIteratorScanKey(&index_iter1); @indexIteratorAdvance(&index_iter1); ) {                                                                                                 +
                                     var table_pr1 = @indexIteratorGetTablePR(&index_iter1)                                                                                                                         +
                                     var slot5 = @indexIteratorGetSlot(&index_iter1)                                                                                                                                +
                                     if (SqlBoolToBool(@vpiGetInt(vpi5, 0) == @prGetInt(table_pr1, 0))) {                                                                                                           +
                                         if (SqlBoolToBool(@prGetInt(table_pr1, 1) == @vpiGetInt(vpi6, 1))) {                                                                                                       +
                                             var aggValues: AggValues                                                                                                                                               +
                                             aggValues.gb_term_attr0 = @vpiGetInt(vpi4, 1)                                                                                                                          +
                                             aggValues.agg_term_attr0 = @vpiGetInt(vpi4, 0)                                                                                                                         +
                                             var hashVal = @hash(aggValues.gb_term_attr0)                                                                                                                           +
                                             var aggPayload = @ptrCast(*AggPayload, @aggHTLookup(&pipelineState.aggHashTable1, hashVal, Query3_Pipeline1_KeyCheck, &aggValues))                                     +
                                             if (aggPayload == nil) {                                                                                                                                               +
                                                 aggPayload = @ptrCast(*AggPayload, @aggHTInsert(&pipelineState.aggHashTable1, hashVal, true))                                                                      +
                                                 aggPayload.gb_term_attr0 = aggValues.gb_term_attr0                                                                                                                 +
                                                 @aggInit(&aggPayload.agg_term_attr0)                                                                                                                               +
                                             }                                                                                                                                                                      +
                                             @aggAdvance(&aggPayload.agg_term_attr0, &aggValues.agg_term_attr0)                                                                                                     +
                                         }                                                                                                                                                                          +
                                     }                                                                                                                                                                              +
                                 }                                                                                                                                                                                  +
                                 @indexIteratorFree(&index_iter1)                                                                                                                                                   +
                             }                                                                                                                                                                                      +
                         }                                                                                                                                                                                          +
                         var vpi_num_tuples = @tableIterGetVPINumTuples(tvi4)                                                                                                                                       +
                     }                                                                                                                                                                                              +
                     @tableIterClose(&pipelineState.tviBase4)                                                                                                                                                       +
                     pipelineState.tviNeedsFree4 = false                                                                                                                                                            +
                 }                                                                                                                                                                                                  +
                 var vpi_num_tuples1 = @tableIterGetVPINumTuples(tvi5)                                                                                                                                              +
             }                                                                                                                                                                                                      +
             @tableIterClose(&pipelineState.tviBase5)                                                                                                                                                               +
             pipelineState.tviNeedsFree5 = false                                                                                                                                                                    +
         }                                                                                                                                                                                                          +
         var vpi_num_tuples2 = @tableIterGetVPINumTuples(tvi6)                                                                                                                                                      +
     }                                                                                                                                                                                                              +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline2_Init(queryState: *QueryState) -> nil {                                                                                                                                                        +
     var threadStateContainer = @execCtxGetTLS(queryState.execCtx)                                                                                                                                                  +
     @tlsReset(threadStateContainer, @sizeOf(P2_State), Query3_Pipeline2_InitPipelineState, Query3_Pipeline2_TearDownPipelineState, queryState)                                                                     +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline2_Run(queryState: *QueryState) -> nil {                                                                                                                                                         +
     var pipelineState = @ptrCast(*P2_State, @tlsGetCurrentThreadState(@execCtxGetTLS(queryState.execCtx)))                                                                                                         +
     var col_oids8: [2]uint32                                                                                                                                                                                       +
     col_oids8[0] = 2                                                                                                                                                                                               +
     col_oids8[1] = 1                                                                                                                                                                                               +
     @iterateTableParallel(1088, col_oids8, queryState, queryState.execCtx, Query3_Pipeline2_ParallelWork)                                                                                                          +
     @aggHTMoveParts(&queryState.aggHashTable, @execCtxGetTLS(queryState.execCtx), @offsetOf(P2_State, aggHashTable1), Query3_Pipeline1_MergePartitions)                                                            +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline2_TearDown(queryState: *QueryState) -> nil {                                                                                                                                                    +
     @tlsClear(@execCtxGetTLS(queryState.execCtx))                                                                                                                                                                  +
     @ensureTrackersStopped(queryState.execCtx)                                                                                                                                                                     +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_InitPipelineState(queryState: *QueryState, pipelineState: *P1_State) -> nil {                                                                                                                 +
     @filterManagerInit(&pipelineState.filterManager, queryState.execCtx)                                                                                                                                           +
     @filterManagerInsertFilter(&pipelineState.filterManager, Query3_Pipeline1_FilterClause)                                                                                                                        +
     @filterManagerInit(&pipelineState.filterManager1, queryState.execCtx)                                                                                                                                          +
     @filterManagerInsertFilter(&pipelineState.filterManager1, Query3_Pipeline1_FilterClause1)                                                                                                                      +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_TearDownPipelineState(queryState: *QueryState, pipelineState: *P1_State) -> nil {                                                                                                             +
     if (pipelineState.tviNeedsFree) {                                                                                                                                                                              +
         @tableIterClose(&pipelineState.tviBase)                                                                                                                                                                    +
         pipelineState.tviNeedsFree = false                                                                                                                                                                         +
     }                                                                                                                                                                                                              +
     @filterManagerFree(&pipelineState.filterManager)                                                                                                                                                               +
     if (pipelineState.tviNeedsFree1) {                                                                                                                                                                             +
         @tableIterClose(&pipelineState.tviBase1)                                                                                                                                                                   +
         pipelineState.tviNeedsFree1 = false                                                                                                                                                                        +
     }                                                                                                                                                                                                              +
     if (pipelineState.tviNeedsFree2) {                                                                                                                                                                             +
         @tableIterClose(&pipelineState.tviBase2)                                                                                                                                                                   +
         pipelineState.tviNeedsFree2 = false                                                                                                                                                                        +
     }                                                                                                                                                                                                              +
     @filterManagerFree(&pipelineState.filterManager1)                                                                                                                                                              +
     if (pipelineState.tviNeedsFree3) {                                                                                                                                                                             +
         @tableIterClose(&pipelineState.tviBase3)                                                                                                                                                                   +
         pipelineState.tviNeedsFree3 = false                                                                                                                                                                        +
     }                                                                                                                                                                                                              +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_ParallelWork(queryState: *QueryState, pipelineState: *P1_State, aggHashTable: *AggregationHashTable) -> nil {                                                                                 +
     var iterBase: AHTIterator                                                                                                                                                                                      +
     var iter = &iterBase                                                                                                                                                                                           +
     for (@aggHTIterInit(iter, aggHashTable); @aggHTIterHasNext(iter); @aggHTIterNext(iter)) {                                                                                                                      +
         var aggRow = @ptrCast(*AggPayload, @aggHTIterGetRow(iter))                                                                                                                                                 +
         var tvi3 = &pipelineState.tviBase3                                                                                                                                                                         +
         var col_oids4: [2]uint32                                                                                                                                                                                   +
         col_oids4[0] = 2                                                                                                                                                                                           +
         col_oids4[1] = 1                                                                                                                                                                                           +
         @tableIterInit(tvi3, queryState.execCtx, 1088, col_oids4)                                                                                                                                                  +
         pipelineState.tviNeedsFree3 = true                                                                                                                                                                         +
         var slot4: TupleSlot                                                                                                                                                                                       +
         for (@tableIterAdvance(tvi3)) {                                                                                                                                                                            +
             var vpi3 = @tableIterGetVPI(tvi3)                                                                                                                                                                      +
             @filterManagerRunFilters(&pipelineState.filterManager1, vpi3, queryState.execCtx)                                                                                                                      +
             for (; @vpiHasNextFiltered(vpi3); @vpiAdvanceFiltered(vpi3)) {                                                                                                                                         +
                 slot4 = @vpiGetSlot(vpi3)                                                                                                                                                                          +
                 var tvi2 = &pipelineState.tviBase2                                                                                                                                                                 +
                 var col_oids3: [3]uint32                                                                                                                                                                           +
                 col_oids3[0] = 3                                                                                                                                                                                   +
                 col_oids3[1] = 1                                                                                                                                                                                   +
                 col_oids3[2] = 2                                                                                                                                                                                   +
                 @tableIterInit(tvi2, queryState.execCtx, 1072, col_oids3)                                                                                                                                          +
                 pipelineState.tviNeedsFree2 = true                                                                                                                                                                 +
                 var slot3: TupleSlot                                                                                                                                                                               +
                 for (@tableIterAdvance(tvi2)) {                                                                                                                                                                    +
                     var vpi2 = @tableIterGetVPI(tvi2)                                                                                                                                                              +
                     for (; @vpiHasNext(vpi2); @vpiAdvance(vpi2)) {                                                                                                                                                 +
                         slot3 = @vpiGetSlot(vpi2)                                                                                                                                                                  +
                         var tvi1 = &pipelineState.tviBase1                                                                                                                                                         +
                         var col_oids2: [2]uint32                                                                                                                                                                   +
                         col_oids2[0] = 4                                                                                                                                                                           +
                         col_oids2[1] = 1                                                                                                                                                                           +
                         @tableIterInit(tvi1, queryState.execCtx, 1081, col_oids2)                                                                                                                                  +
                         pipelineState.tviNeedsFree1 = true                                                                                                                                                         +
                         var slot2: TupleSlot                                                                                                                                                                       +
                         for (@tableIterAdvance(tvi1)) {                                                                                                                                                            +
                             var vpi1 = @tableIterGetVPI(tvi1)                                                                                                                                                      +
                             @filterManagerRunFilters(&pipelineState.filterManager, vpi1, queryState.execCtx)                                                                                                       +
                             for (; @vpiHasNextFiltered(vpi1); @vpiAdvanceFiltered(vpi1)) {                                                                                                                         +
                                 slot2 = @vpiGetSlot(vpi1)                                                                                                                                                          +
                                 var tvi = &pipelineState.tviBase                                                                                                                                                   +
                                 var col_oids1: [2]uint32                                                                                                                                                           +
                                 col_oids1[0] = 1                                                                                                                                                                   +
                                 col_oids1[1] = 4                                                                                                                                                                   +
                                 @tableIterInit(tvi, queryState.execCtx, 1092, col_oids1)                                                                                                                           +
                                 pipelineState.tviNeedsFree = true                                                                                                                                                  +
                                 var slot1: TupleSlot                                                                                                                                                               +
                                 for (@tableIterAdvance(tvi)) {                                                                                                                                                     +
                                     var vpi = @tableIterGetVPI(tvi)                                                                                                                                                +
                                     for (; @vpiHasNext(vpi); @vpiAdvance(vpi)) {                                                                                                                                   +
                                         slot1 = @vpiGetSlot(vpi)                                                                                                                                                   +
                                         if (SqlBoolToBool(@vpiGetInt(vpi1, 1) == @vpiGetInt(vpi2, 2)) and SqlBoolToBool(@mod(@vpiGetInt(vpi2, 1) * @vpiGetInt(vpi2, 2), @intToSql(10000)) == @vpiGetInt(vpi, 0))) {+
                                             var col_oids: [2]uint32                                                                                                                                                +
                                             col_oids[0] = 3                                                                                                                                                        +
                                             col_oids[1] = 1                                                                                                                                                        +
                                             var index_iter: IndexIterator                                                                                                                                          +
                                             @indexIteratorInit(&index_iter, queryState.execCtx, 1, 1090, 1091, col_oids)                                                                                           +
                                             var lo_index_pr = @indexIteratorGetLoPR(&index_iter)                                                                                                                   +
                                             var hi_index_pr = @indexIteratorGetHiPR(&index_iter)                                                                                                                   +
                                             @prSetInt(lo_index_pr, 0, @vpiGetInt(vpi, 1))                                                                                                                          +
                                             @prSetInt(hi_index_pr, 0, @vpiGetInt(vpi, 1))                                                                                                                          +
                                             for (@indexIteratorScanKey(&index_iter); @indexIteratorAdvance(&index_iter); ) {                                                                                       +
                                                 var table_pr = @indexIteratorGetTablePR(&index_iter)                                                                                                               +
                                                 var slot = @indexIteratorGetSlot(&index_iter)                                                                                                                      +
                                                 if (SqlBoolToBool(@vpiGetInt(vpi, 1) == @prGetInt(table_pr, 0))) {                                                                                                 +
                                                     if (SqlBoolToBool(@prGetInt(table_pr, 1) == @vpiGetInt(vpi3, 1))) {                                                                                            +
                                                         if (SqlBoolToBool(@vpiGetInt(vpi1, 1) == aggRow.gb_term_attr0) and SqlBoolToBool(@vpiGetInt(vpi2, 0) == @aggResult(&aggRow.agg_term_attr0))) { }           +
                                                     }                                                                                                                                                              +
                                                 }                                                                                                                                                                  +
                                             }                                                                                                                                                                      +
                                             @indexIteratorFree(&index_iter)                                                                                                                                        +
                                         }                                                                                                                                                                          +
                                     }                                                                                                                                                                              +
                                     var vpi_num_tuples = @tableIterGetVPINumTuples(tvi)                                                                                                                            +
                                 }                                                                                                                                                                                  +
                                 @tableIterClose(&pipelineState.tviBase)                                                                                                                                            +
                                 pipelineState.tviNeedsFree = false                                                                                                                                                 +
                             }                                                                                                                                                                                      +
                             var vpi_num_tuples1 = @tableIterGetVPINumTuples(tvi1)                                                                                                                                  +
                         }                                                                                                                                                                                          +
                         @tableIterClose(&pipelineState.tviBase1)                                                                                                                                                   +
                         pipelineState.tviNeedsFree1 = false                                                                                                                                                        +
                     }                                                                                                                                                                                              +
                     var vpi_num_tuples2 = @tableIterGetVPINumTuples(tvi2)                                                                                                                                          +
                 }                                                                                                                                                                                                  +
                 @tableIterClose(&pipelineState.tviBase2)                                                                                                                                                           +
                 pipelineState.tviNeedsFree2 = false                                                                                                                                                                +
             }                                                                                                                                                                                                      +
             var vpi_num_tuples3 = @tableIterGetVPINumTuples(tvi3)                                                                                                                                                  +
         }                                                                                                                                                                                                          +
         @tableIterClose(&pipelineState.tviBase3)                                                                                                                                                                   +
         pipelineState.tviNeedsFree3 = false                                                                                                                                                                        +
     }                                                                                                                                                                                                              +
     @aggHTIterClose(iter)                                                                                                                                                                                          +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_Init(queryState: *QueryState) -> nil {                                                                                                                                                        +
     var threadStateContainer = @execCtxGetTLS(queryState.execCtx)                                                                                                                                                  +
     @tlsReset(threadStateContainer, @sizeOf(P1_State), Query3_Pipeline1_InitPipelineState, Query3_Pipeline1_TearDownPipelineState, queryState)                                                                     +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_Run(queryState: *QueryState) -> nil {                                                                                                                                                         +
     var pipelineState = @ptrCast(*P1_State, @tlsGetCurrentThreadState(@execCtxGetTLS(queryState.execCtx)))                                                                                                         +
     @aggHTParallelPartScan(&queryState.aggHashTable, queryState, @execCtxGetTLS(queryState.execCtx), Query3_Pipeline1_ParallelWork)                                                                                +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_Pipeline1_TearDown(queryState: *QueryState) -> nil {                                                                                                                                                    +
     @tlsClear(@execCtxGetTLS(queryState.execCtx))                                                                                                                                                                  +
     @ensureTrackersStopped(queryState.execCtx)                                                                                                                                                                     +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
 fun Query3_TearDown(queryState: *QueryState) -> nil {                                                                                                                                                              +
     @aggHTFree(&queryState.aggHashTable)                                                                                                                                                                           +
     return                                                                                                                                                                                                         +
 }                                                                                                                                                                                                                  +
                                                                                                                                                                                                                    +
                                                                                                                                                                                                                    +
 
(1 row)
@lmwnshn lmwnshn added the performance Performance related issues or changes. label May 27, 2021
@lmwnshn lmwnshn self-assigned this May 27, 2021
@lmwnshn lmwnshn removed their assignment May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance Performance related issues or changes.
Projects
None yet
Development

No branches or pull requests

1 participant