-- the sum of a float column that is not grouped: the running sum stays in a register, where a sum per group updates the group's slot in memory and each row waits for the store of the one before it -- label: `SELECT sum(value_a)` of a float8 column over {rows} rows -- ordered: yes --@ setup DO $do$ BEGIN IF to_regclass('fs_readings') IS NULL THEN CREATE TABLE fs_readings (id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, value_a float8 NOT NULL, count_a int NOT NULL); INSERT INTO fs_readings (value_a, count_a) SELECT round((random() * 1000)::numeric, 3)::float8, (random() * 100)::int FROM generate_series(1, {rows}) g; CREATE INDEX fs_readings_col ON fs_readings USING sift_col (id, value_a, count_a); END IF; END $do$; VACUUM (FREEZE, ANALYZE) fs_readings --@ pg SELECT sum(value_a) AS total_a FROM fs_readings