Skip to content
  • Dag Wanvik's avatar
    247165b5
    Bug#26612356 window functions: fix cost estimates · 247165b5
    Dag Wanvik authored
    - Incorporate cost of any sorting of the result set for windowing, i.e.
      we have an ORDER BY and/or PARTITION BY in the window specification
    
    - Add this information to JSON explain
    
    - Fix a bug in JSON explain for windowing: we only printed the
      effective sort key, i.e. the concatenation of any PARTITION BY and
      any ORDER BY, if we had an ORDER BY, not for solely PARTITION
      BY. (This fix has nothing to do with costing, but was discovered
      while studying the explain outputs.)
    
    - Fixed a bug where before, the cost of a final ORDER BY would get
      wrongly attributed the the windowing, e.g. for
    
      EXPLAIN FORMAT=JSON SELECT i, j, SUM(i+j) OVER (ROWS UNBOUNDED PRECEDING)
    foo FROM t ORDER BY foo;
    
      In this case, the windowing has no ordering.
    
    - Added new explain tests
    247165b5
    Bug#26612356 window functions: fix cost estimates
    Dag Wanvik authored
    - Incorporate cost of any sorting of the result set for windowing, i.e.
      we have an ORDER BY and/or PARTITION BY in the window specification
    
    - Add this information to JSON explain
    
    - Fix a bug in JSON explain for windowing: we only printed the
      effective sort key, i.e. the concatenation of any PARTITION BY and
      any ORDER BY, if we had an ORDER BY, not for solely PARTITION
      BY. (This fix has nothing to do with costing, but was discovered
      while studying the explain outputs.)
    
    - Fixed a bug where before, the cost of a final ORDER BY would get
      wrongly attributed the the windowing, e.g. for
    
      EXPLAIN FORMAT=JSON SELECT i, j, SUM(i+j) OVER (ROWS UNBOUNDED PRECEDING)
    foo FROM t ORDER BY foo;
    
      In this case, the windowing has no ordering.
    
    - Added new explain tests
Loading