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

CHBenchmark Q19 Performance #1602

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

CHBenchmark Q19 Performance #1602

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

noisepage=# \pset pager off
Pager usage is off.
noisepage=# explain (format tpl) SELECT sum(ol_amount) AS revenue
FROM order_line,
     item
WHERE (ol_i_id = i_id
       AND i_data LIKE '%a'
       AND ol_quantity >= 1
       AND ol_quantity <= 10
       AND 1 <= i_price AND i_price <= 400000
       AND ol_w_id IN (1,
                       2,
                       3))
  OR (ol_i_id = i_id
      AND i_data LIKE '%b'
      AND ol_quantity >= 1
      AND ol_quantity <= 10
      AND 1 <= i_price AND i_price <= 400000
      AND ol_w_id IN (1,
                      2,
                      4))
  OR (ol_i_id = i_id
      AND i_data LIKE '%c'
      AND ol_quantity >= 1
      AND ol_quantity <= 10
      AND 1 <= i_price AND i_price <= 400000
      AND ol_w_id IN (1,
                      5,
                      3));
                                                                                                                                       QUERY PLAN                                                                                                                                        
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 struct AggPayload {                                                                                                                                                                                                                                                                    +
                                                                                                                                                                                                                                                                                        +
 }                                                                                                                                                                                                                                                                                      +
 struct AggValues {                                                                                                                                                                                                                                                                     +
                                                                                                                                                                                                                                                                                        +
 }                                                                                                                                                                                                                                                                                      +
 struct QueryState {                                                                                                                                                                                                                                                                    +
     execCtx: *ExecutionContext                                                                                                                                                                                                                                                         +
     aggs   : AggPayload                                                                                                                                                                                                                                                                +
 }                                                                                                                                                                                                                                                                                      +
 struct P2_State {                                                                                                                                                                                                                                                                      +
     tviBase      : TableVectorIterator                                                                                                                                                                                                                                                 +
     tviNeedsFree : bool                                                                                                                                                                                                                                                                +
     tviBase1     : TableVectorIterator                                                                                                                                                                                                                                                 +
     tviNeedsFree1: bool                                                                                                                                                                                                                                                                +
     aggs1        : AggPayload                                                                                                                                                                                                                                                          +
 }                                                                                                                                                                                                                                                                                      +
 struct P1_State {                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 }                                                                                                                                                                                                                                                                                      +
 fun MergeAggregates(queryState: *QueryState, pipelineState: *P2_State) -> nil {                                                                                                                                                                                                        +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Init(queryState: *QueryState) -> nil {                                                                                                                                                                                                                                     +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline2_InitPipelineState(queryState: *QueryState, pipelineState: *P2_State) -> nil {                                                                                                                                                                                    +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline2_TearDownPipelineState(queryState: *QueryState, pipelineState: *P2_State) -> nil {                                                                                                                                                                                +
     if (pipelineState.tviNeedsFree) {                                                                                                                                                                                                                                                  +
         @tableIterClose(&pipelineState.tviBase)                                                                                                                                                                                                                                        +
         pipelineState.tviNeedsFree = false                                                                                                                                                                                                                                             +
     }                                                                                                                                                                                                                                                                                  +
     if (pipelineState.tviNeedsFree1) {                                                                                                                                                                                                                                                 +
         @tableIterClose(&pipelineState.tviBase1)                                                                                                                                                                                                                                       +
         pipelineState.tviNeedsFree1 = false                                                                                                                                                                                                                                            +
     }                                                                                                                                                                                                                                                                                  +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline2_ParallelWork(queryState: *QueryState, pipelineState: *P2_State, tvi1: *TableVectorIterator) -> nil {                                                                                                                                                             +
     var slot1: TupleSlot                                                                                                                                                                                                                                                               +
     for (@tableIterAdvance(tvi1)) {                                                                                                                                                                                                                                                    +
         var vpi1 = @tableIterGetVPI(tvi1)                                                                                                                                                                                                                                              +
         for (; @vpiHasNext(vpi1); @vpiAdvance(vpi1)) {                                                                                                                                                                                                                                 +
             slot1 = @vpiGetSlot(vpi1)                                                                                                                                                                                                                                                  +
             var tvi = &pipelineState.tviBase                                                                                                                                                                                                                                           +
             var col_oids: [3]uint32                                                                                                                                                                                                                                                    +
             col_oids[0] = 3                                                                                                                                                                                                                                                            +
             col_oids[1] = 4                                                                                                                                                                                                                                                            +
             col_oids[2] = 1                                                                                                                                                                                                                                                            +
             @tableIterInit(tvi, queryState.execCtx, 1089, col_oids)                                                                                                                                                                                                                    +
             pipelineState.tviNeedsFree = true                                                                                                                                                                                                                                          +
             var slot: TupleSlot                                                                                                                                                                                                                                                        +
             for (@tableIterAdvance(tvi)) {                                                                                                                                                                                                                                             +
                 var vpi = @tableIterGetVPI(tvi)                                                                                                                                                                                                                                        +
                 for (; @vpiHasNext(vpi); @vpiAdvance(vpi)) {                                                                                                                                                                                                                           +
                     slot = @vpiGetSlot(vpi)                                                                                                                                                                                                                                            +
                     if (SqlBoolToBool(@vpiGetInt(vpi1, 2) == @vpiGetInt(vpi, 2)) and SqlBoolToBool(@like(@vpiGetString(vpi, 1), @stringToSql("%a"))) or SqlBoolToBool(@vpiGetInt(vpi1, 2) == @vpiGetInt(vpi, 2)) and SqlBoolToBool(@like(@vpiGetString(vpi, 1), @stringToSql("%b")))) {+
                         var aggValues: AggValues                                                                                                                                                                                                                                       +
                     }                                                                                                                                                                                                                                                                  +
                 }                                                                                                                                                                                                                                                                      +
                 var vpi_num_tuples = @tableIterGetVPINumTuples(tvi)                                                                                                                                                                                                                    +
             }                                                                                                                                                                                                                                                                          +
             @tableIterClose(&pipelineState.tviBase)                                                                                                                                                                                                                                    +
             pipelineState.tviNeedsFree = false                                                                                                                                                                                                                                         +
         }                                                                                                                                                                                                                                                                              +
         var vpi_num_tuples1 = @tableIterGetVPINumTuples(tvi1)                                                                                                                                                                                                                          +
     }                                                                                                                                                                                                                                                                                  +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline2_Init(queryState: *QueryState) -> nil {                                                                                                                                                                                                                           +
     var threadStateContainer = @execCtxGetTLS(queryState.execCtx)                                                                                                                                                                                                                      +
     @tlsReset(threadStateContainer, @sizeOf(P2_State), Query20_Pipeline2_InitPipelineState, Query20_Pipeline2_TearDownPipelineState, queryState)                                                                                                                                       +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline2_Run(queryState: *QueryState) -> nil {                                                                                                                                                                                                                            +
     var pipelineState = @ptrCast(*P2_State, @tlsGetCurrentThreadState(@execCtxGetTLS(queryState.execCtx)))                                                                                                                                                                             +
     var col_oids1: [3]uint32                                                                                                                                                                                                                                                           +
     col_oids1[0] = 1                                                                                                                                                                                                                                                                   +
     col_oids1[1] = 9                                                                                                                                                                                                                                                                   +
     col_oids1[2] = 5                                                                                                                                                                                                                                                                   +
     @iterateTableParallel(1076, col_oids1, queryState, queryState.execCtx, Query20_Pipeline2_ParallelWork)                                                                                                                                                                             +
     @tlsIterate(@execCtxGetTLS(queryState.execCtx), queryState, MergeAggregates)                                                                                                                                                                                                       +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline2_TearDown(queryState: *QueryState) -> nil {                                                                                                                                                                                                                       +
     @tlsClear(@execCtxGetTLS(queryState.execCtx))                                                                                                                                                                                                                                      +
     @ensureTrackersStopped(queryState.execCtx)                                                                                                                                                                                                                                         +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline1_InitPipelineState(queryState: *QueryState, pipelineState: *P1_State) -> nil {                                                                                                                                                                                    +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline1_TearDownPipelineState(queryState: *QueryState, pipelineState: *P1_State) -> nil {                                                                                                                                                                                +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline1_SerialWork(queryState: *QueryState, pipelineState: *P1_State) -> nil {                                                                                                                                                                                           +
     var aggRow = &queryState.aggs                                                                                                                                                                                                                                                      +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline1_Init(queryState: *QueryState) -> nil {                                                                                                                                                                                                                           +
     var threadStateContainer = @execCtxGetTLS(queryState.execCtx)                                                                                                                                                                                                                      +
     @tlsReset(threadStateContainer, @sizeOf(P1_State), Query20_Pipeline1_InitPipelineState, Query20_Pipeline1_TearDownPipelineState, queryState)                                                                                                                                       +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline1_Run(queryState: *QueryState) -> nil {                                                                                                                                                                                                                            +
     var pipelineState = @ptrCast(*P1_State, @tlsGetCurrentThreadState(@execCtxGetTLS(queryState.execCtx)))                                                                                                                                                                             +
     Query20_Pipeline1_SerialWork(queryState, pipelineState)                                                                                                                                                                                                                            +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_Pipeline1_TearDown(queryState: *QueryState) -> nil {                                                                                                                                                                                                                       +
     @tlsClear(@execCtxGetTLS(queryState.execCtx))                                                                                                                                                                                                                                      +
     @ensureTrackersStopped(queryState.execCtx)                                                                                                                                                                                                                                         +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
 fun Query20_TearDown(queryState: *QueryState) -> nil {                                                                                                                                                                                                                                 +
     return                                                                                                                                                                                                                                                                             +
 }                                                                                                                                                                                                                                                                                      +
                                                                                                                                                                                                                                                                                        +
                                                                                                                                                                                                                                                                                        +
 
(1 row)
@lmwnshn lmwnshn added the performance Performance related issues or changes. label 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