Re: [HACKERS] Hash support for grouping sets - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: [HACKERS] Hash support for grouping sets
Date
Msg-id 8760ja43ko.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: [HACKERS] Hash support for grouping sets  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: [HACKERS] Hash support for grouping sets  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: [HACKERS] Hash support for grouping sets  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Another small update to the patch, this time to eliminate any
possibility of integer overflow when handling extremely large estimated
groupings.

Key change:

-                   k_weights[i] = (int) floor(sz / scale);
+                   /*
+                    * If sz is enormous, but work_mem (and hence scale) is
+                    * small, avoid integer overflow here.
+                    */
+                   k_weights[i] = (int) Min(floor(sz / scale),
+                                            k_capacity + 1.0);

-- 
Andrew (irc:RhodiumToad)


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: [HACKERS] scram and \password
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] WIP: Faster Expression Processing v4