Search notes:

Oracle SQL Plan operation: WINDOW (BUFFER)

The SQL plan operation WINDOW (BUFFER) is used in SQL statements with analytic functions whose OVER() clause does not have a partition by clause or an order by clause.
If the OVER() clause had either or both clauses, Oracle would use the WINDOW (SORT) plan operation.
create table tq84_A (
   pt   varchar2(1),
   nm   number
);

explain plan for
select
   pt,
   nm,
   MAX(NM) OVER() -- NOTE: NO PARTITION BY CLAUSE
from
   tq84_A;

select * from table(dbms_xplan.display(format => 'basic'));
--
-- -------------------------------------
-- | Id  | Operation          | Name   |
-- -------------------------------------
-- |   0 | SELECT STATEMENT   |        |
-- |   1 |  WINDOW BUFFER     |        |
-- |   2 |   TABLE ACCESS FULL| TQ84_A |
-- -------------------------------------

drop table tq84_A;

Update 2022-04-06

I just found out that in the following case where an analytic function is combined with a group by and/or(?) aggregate function, the WINDOW BUFFER operations is also used:
create table tq84_tab (
   val   number,
   grp_1 char(1),
   grp_2 char(1)
);

insert into tq84_tab
select
   mod(level * 37, 11),
   chr(ascii('A') + mod(level  , 13)),
   chr(ascii('A') + mod(level*7, 17))
from
   dual connect by level <= 10000;

explain plan for
select
   sum(sum(val)) over (partition by grp_1 order by grp_2) val,
   grp_1,
   grp_2
from
   tq84_tab
group by
   grp_1,
   grp_2
;

select * from table(dbms_xplan.display(format=>'basic'));
--
-- ----------------------------------------
-- | Id  | Operation           | Name     |
-- ----------------------------------------
-- |   0 | SELECT STATEMENT    |          |
-- |   1 |  WINDOW BUFFER      |          |
-- |   2 |   SORT GROUP BY     |          |
-- |   3 |    TABLE ACCESS FULL| TQ84_TAB |
-- ----------------------------------------

drop table tq84_tab;

See also

Execution plan operations

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199200, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/SQL/statement/execution/plan/operations/window/buffer/index(110): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78