Skip to content

Commit 631dd0e

Browse files
author
Burak Yucesoy
committed
Tell size of the internal state object to PostgreSQL
When this value is not specified, PostgreSQL planner estimates the memory need lesser than actual need and thinks it is OK to use Hash Aggreage. Since actual memory need is higher, available memory may not enough to use Hash Aggregate. This causes out of memory issues and/or crashes.
1 parent a06e5ea commit 631dd0e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

hll--2.10.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ CREATE FUNCTION hll_ceil_card_unpacked(internal)
465465
CREATE AGGREGATE hll_union_agg (hll) (
466466
SFUNC = hll_union_trans,
467467
STYPE = internal,
468+
SSPACE = 131113,
468469
FINALFUNC = hll_pack
469470
);
470471

@@ -475,33 +476,38 @@ CREATE AGGREGATE hll_union_agg (hll) (
475476
CREATE AGGREGATE hll_add_agg (hll_hashval) (
476477
SFUNC = hll_add_trans0,
477478
STYPE = internal,
479+
SSPACE = 131113,
478480
FINALFUNC = hll_pack
479481
);
480482

481483
-- Add aggregate function, returns hll.
482484
CREATE AGGREGATE hll_add_agg (hll_hashval, integer) (
483485
SFUNC = hll_add_trans1,
484486
STYPE = internal,
487+
SSPACE = 131113,
485488
FINALFUNC = hll_pack
486489
);
487490

488491
-- Add aggregate function, returns hll.
489492
CREATE AGGREGATE hll_add_agg (hll_hashval, integer, integer) (
490493
SFUNC = hll_add_trans2,
491494
STYPE = internal,
495+
SSPACE = 131113,
492496
FINALFUNC = hll_pack
493497
);
494498

495499
-- Add aggregate function, returns hll.
496500
CREATE AGGREGATE hll_add_agg (hll_hashval, integer, integer, bigint) (
497501
SFUNC = hll_add_trans3,
498502
STYPE = internal,
503+
SSPACE = 131113,
499504
FINALFUNC = hll_pack
500505
);
501506

502507
-- Add aggregate function, returns hll.
503508
CREATE AGGREGATE hll_add_agg (hll_hashval, integer, integer, bigint, integer) (
504509
SFUNC = hll_add_trans4,
505510
STYPE = internal,
511+
SSPACE = 131113,
506512
FINALFUNC = hll_pack
507513
);

0 commit comments

Comments
 (0)