By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
SELECT *,
SUM(perc) OVER ()
FROM (
-- YOUR QUERY GOES HERE
SELECT generate_series(1,10) AS perc
) j
perc | sum |
---|---|
1 | 55 |
2 | 55 |
3 | 55 |
4 | 55 |
5 | 55 |
6 | 55 |
7 | 55 |
8 | 55 |
9 | 55 |
10 | 55 |
SELECT *,
SUM(perc) OVER (RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
FROM (
-- YOUR QUERY GOES HERE
SELECT generate_series(1,10) AS perc
) j
perc | sum |
---|---|
1 | 55 |
2 | 55 |
3 | 55 |
4 | 55 |
5 | 55 |
6 | 55 |
7 | 55 |
8 | 55 |
9 | 55 |
10 | 55 |