-
Notifications
You must be signed in to change notification settings - Fork 0
Optimize the harmean function for speed #12
Copy link
Copy link
Open
Labels
Description
I've noticed that the public.harmean function can be around 3x slower than doing e.g.
COUNT(*) / SUM( 1 / var )See also, on literally this exact same topic:
https://dba.stackexchange.com/questions/243804/user-defined-harmonic-mean-function-performs-worse-than-query-in-postgresql-9-6
Is it possible that the numeric type is to blame?
However, calculations on numeric values are very slow compared to the integer types, or to the floating-point types described in the next section.
from https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL
Reactions are currently unavailable