Skip to content

Benchmark window functions#2913

Draft
fulghum wants to merge 4 commits into
mainfrom
fulghum/window-functions-v2
Draft

Benchmark window functions#2913
fulghum wants to merge 4 commits into
mainfrom
fulghum/window-functions-v2

Conversation

@fulghum

@fulghum fulghum commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
Main PR
covering_index_scan_postgres 1864.88/s 1922.81/s +3.1%
groupby_scan_postgres 140.68/s 135.62/s -3.6%
index_join_postgres 661.42/s 663.79/s +0.3%
index_join_scan_postgres 812.70/s 812.85/s 0.0%
index_scan_postgres 27.04/s 27.32/s +1.0%
oltp_delete_insert_postgres 796.16/s 807.51/s +1.4%
oltp_insert 706.00/s 691.05/s -2.2%
oltp_point_select 2930.49/s 2961.79/s +1.0%
oltp_read_only 2983.80/s 2971.75/s -0.5%
oltp_read_write 2362.62/s 2348.25/s -0.7%
oltp_update_index 741.43/s 732.00/s -1.3%
oltp_update_non_index 769.13/s 779.36/s +1.3%
oltp_write_only 1763.40/s 1766.71/s +0.1%
select_random_points 1937.38/s 1933.36/s -0.3%
select_random_ranges 1513.14/s 1514.13/s 0.0%
table_scan_postgres 25.32/s 25.65/s +1.3%
types_delete_insert_postgres 755.83/s 773.18/s +2.2%
types_table_scan_postgres 11.29/s 11.37/s +0.7%

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
Main PR
Total 42090 42090
Successful 18275 18302
Failures 23815 23788
Partial Successes1 5335 5345
Main PR
Successful 43.4189% 43.4830%
Failures 56.5811% 56.5170%

${\color{red}Regressions (1)}$

random

QUERY:          (SELECT unique1 AS random
  FROM onek ORDER BY random() LIMIT 1)
INTERSECT
(SELECT unique1 AS random
  FROM onek ORDER BY random() LIMIT 1)
INTERSECT
(SELECT unique1 AS random
  FROM onek ORDER BY random() LIMIT 1);
RECEIVED ERROR: expected row count 0 but received 1

${\color{lightgreen}Progressions (29)}$

aggregates

QUERY: SELECT sum(four) AS sum_1500 FROM onek;
QUERY: SELECT sum(a) AS sum_198 FROM aggtest;
QUERY: select sum('NaN'::numeric) from generate_series(1,3);
QUERY: select avg('NaN'::numeric) from generate_series(1,3);
QUERY: select ten, count(*), sum(four) from onek
group by ten order by ten;
QUERY: select ten, count(four), sum(DISTINCT four) from onek
group by ten order by ten;
QUERY: select ten, sum(distinct four) from onek a
group by ten
having exists (select 1 from onek b where sum(distinct a.four) = b.four);
QUERY: select unique1, count(*), sum(twothousand) from tenk1
group by unique1
having sum(fivethous) > 4975
order by sum(twothousand);

matview

QUERY: SELECT * FROM mvtest_tv ORDER BY type;

numeric

QUERY: SELECT SUM(9999::numeric) FROM generate_series(1, 100000);
QUERY: SELECT SUM((-9999)::numeric) FROM generate_series(1, 100000);

subselect

QUERY: select f1, ss1 as relabel from
    (select *, (select sum(f1) from int4_tbl b where f1 >= a.f1) as ss1
     from int4_tbl a) ss;
QUERY: select sum(ss.tst::int) from
  onek o cross join lateral (
  select i.ten in (select f1 from int4_tbl where f1 <= o.hundred) as tst,
         random() as r
  from onek i where i.unique1 = o.unique1 ) ss
where o.ten = 0;
QUERY: select sum(o.four), sum(ss.a) from
  onek o cross join lateral (
    with recursive x(a) as
      (select o.four as a
       union
       select a + 1 from x
       where a < 10)
    select * from x
  ) ss
where o.ten = 1;

window

QUERY: SELECT row_number() OVER (ORDER BY unique2) FROM tenk1 WHERE unique2 < 10;
QUERY: SELECT * FROM(
  SELECT count(*) OVER (PARTITION BY four ORDER BY ten) +
    sum(hundred) OVER (PARTITION BY two ORDER BY ten) AS total,
    count(*) OVER (PARTITION BY four ORDER BY ten) AS fourcount,
    sum(hundred) OVER (PARTITION BY two ORDER BY ten) AS twosum
    FROM tenk1
)sub
WHERE total <> fourcount + twosum;
QUERY: SELECT rank() OVER (ORDER BY length('abc'));
QUERY: SELECT * FROM
  (SELECT empno,
          salary,
          rank() OVER (ORDER BY salary DESC) r
   FROM empsalary) emp
WHERE r <= 3;
QUERY: SELECT * FROM
  (SELECT empno,
          salary,
          dense_rank() OVER (ORDER BY salary DESC) dr
   FROM empsalary) emp
WHERE dr = 1;
QUERY: SELECT i,SUM(v::smallint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
  FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v);
QUERY: SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
  FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v);
QUERY: SELECT i,SUM(v::bigint) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
  FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v);
QUERY: SELECT i,SUM(v::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
  FROM (VALUES(1,1.1),(2,2.2),(3,NULL),(4,NULL)) t(i,v);
QUERY: SELECT SUM(n::numeric) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
  FROM (VALUES(1,1.01),(2,2),(3,3)) v(i,n);
QUERY: SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND CURRENT ROW)
  FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v);
QUERY: SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING)
  FROM (VALUES(1,1),(2,2),(3,NULL),(4,NULL)) t(i,v);
QUERY: SELECT i,SUM(v::int) OVER (ORDER BY i ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
  FROM (VALUES(1,1),(2,2),(3,3),(4,4)) t(i,v);
QUERY: SELECT a, b,
       SUM(b) OVER(ORDER BY A ROWS BETWEEN 1 PRECEDING AND CURRENT ROW)
FROM (VALUES(1,1::numeric),(2,2),(3,'NaN'),(4,3),(5,4)) t(a,b);

with

QUERY: WITH RECURSIVE t(n) AS (
    VALUES (1)
UNION ALL
    SELECT n+1 FROM t WHERE n < 100
)
SELECT sum(n) FROM t;

Footnotes

  1. These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.

@fulghum fulghum force-pushed the fulghum/window-functions-v2 branch from 78394fa to 6dc96ce Compare July 10, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant