OLAP_SCAN_OPERATOR的PlanInfo里面为什么有时候有projections信息,有时候没有?

Viewed 42

测试的是TPCH Q21:

select
    s_name,
    count(*) as numwait
from
    supplier,
    lineitem l1,
    orders,
    nation
where
        s_suppkey = l1.l_suppkey
  and o_orderkey = l1.l_orderkey
  and o_orderstatus = 'F'
  and l1.l_receiptdate > l1.l_commitdate
  and exists (
    select
        *
    from
        lineitem l2
    where
            l2.l_orderkey = l1.l_orderkey
      and l2.l_suppkey <> l1.l_suppkey
)
  and not exists (
    select
        *
    from
        lineitem l3
    where
            l3.l_orderkey = l1.l_orderkey
      and l3.l_suppkey <> l1.l_suppkey
      and l3.l_receiptdate > l3.l_commitdate
)
  and s_nationkey = n_nationkey
  and n_name = 'PERU'
group by
    s_name
order by
    numwait desc,
    s_name
    limit 100;

发现对于同一个表lineitem的Scan,有时候有projections字段,有时候没有,这是为什么?

OLAP_SCAN_OPERATOR  (id=11.  table  name  =  lineitem):
      -  PlanInfo
            -  TABLE:  tpch1t.lineitem(lineitem),  PREAGGREGATION:  ON
            -  runtime  filters:  RF008[min_max]  ->  l_orderkey,  RF009[in_or_bloom]  ->  l_orderkey
            -  partitions=1/1  (lineitem),  tablets=96/96,  tabletList=10559,10561,10563  ...
            -  cardinality=5999989709,  avgRowSize=0.0,  numNodes=1
            -  pushAggOp=NONE
      -  BlocksProduced:  sum  51.574K  (51574),  avg  1.074K  (1074),  max  1.076K  (1076),  min  1.072K  (1072)
      -  CloseTime:  avg  1.452us,  max  2.169us,  min  931ns
      -  ExecTime:  avg  2s523ms,  max  2s918ms,  min  1s947ms
      -  MemoryUsage:  sum  ,  avg  ,  max  ,  min  
            -  PeakMemoryUsage:  sum  0.00  ,  avg  0.00  ,  max  0.00  ,  min  0.00  
      -  OpenTime:  avg  271.277us,  max  2.895ms,  min  153.548us
      -  ProjectionTime:  avg  0ns,  max  0ns,  min  0ns
      -  RowsProduced:  sum  200.476996M  (200476996),  avg  4.176604M  (4176604),  max  4.178575M  (4178575),  min  4.175047M  (4175047)
      -  RuntimeFilterInfo:  sum  ,  avg  ,  max  ,  min  
      -  WaitForDependency[OLAP_SCAN_OPERATOR_DEPENDENCY]Time:  avg  2s483ms,  max  2s884ms,  min  1s942ms
      VScanner:
            -  MemoryUsage:  sum  ,  avg  ,  max  ,  min  
            -  FreeBlocks:  sum  2.81  GB,  avg  60.00  MB,  max  60.00  MB,  min  60.00  MB
OLAP_SCAN_OPERATOR  (id=7.  table  name  =  lineitem):
      -  PlanInfo
            -  TABLE:  tpch1t.lineitem(lineitem),  PREAGGREGATION:  ON
            -  PREDICATES:  (l_receiptdate  >  l_commitdate)
            -  runtime  filters:  RF004[min_max]  ->  l_orderkey,  RF005[in_or_bloom]  ->  l_orderkey
            -  partitions=1/1  (lineitem),  tablets=96/96,  tabletList=10559,10561,10563  ...
            -  cardinality=5999989709,  avgRowSize=0.0,  numNodes=1
            -  pushAggOp=NONE
            -  projections:  l_orderkey,  l_suppkey
            -  project  output  tuple  id:  11
      -  BlocksProduced:  sum  174.435K  (174435),  avg  3.634K  (3634),  max  3.649K  (3649),  min  3.61K  (3610)
      -  CloseTime:  avg  1.643us,  max  2.377us,  min  986ns
      -  ExecTime:  avg  774.877ms,  max  1s95ms,  min  583.740ms
      -  MemoryUsage:  sum  ,  avg  ,  max  ,  min  
            -  PeakMemoryUsage:  sum  0.00  ,  avg  0.00  ,  max  0.00  ,  min  0.00  
      -  OpenTime:  avg  268.307us,  max  1.966ms,  min  187.788us
      -  ProjectionTime:  avg  145.868ms,  max  236.59ms,  min  85.731ms
      -  RowsProduced:  sum  595.638596M  (595638596),  avg  12.409137M  (12409137),  max  12.422M  (12422000),  min  12.395956M  (12395956)
      -  RuntimeFilterInfo:  sum  ,  avg  ,  max  ,  min  
      -  WaitForDependency[OLAP_SCAN_OPERATOR_DEPENDENCY]Time:  avg  201.268ms,  max  346.249ms,  min  76.73ms
      VScanner:
            -  MemoryUsage:  sum  ,  avg  ,  max  ,  min  
                  -  FreeBlocks:  sum  2.48  GB,  avg  53.00  MB,  max  53.06  MB,  min  52.94  MB
1 Answers

image.png

看查询规划,如果带了project计算的就会有这个时间