> CREATE OR REPLACE FUNCTION array_add(int[],int[]) RETURNS int[] AS $$
>    -- Add two arrays.
>    select
>       ARRAY (
>          SELECT coalesce($1[i],0) + coalesce($2[i],0)
>          FROM (
>             select generate_series(least(array_lower($1, 1),array_lower($2,
> 1)), greatest(array_upper($1, 1),array_upper($2, 1)), 1) AS i
>          ) sub
>    GROUP BY i
>    ORDER BY i
>    );
> $$ LANGUAGE sql STRICT IMMUTABLE;

it seems that both the GROUP and ORDER BY are superfluous and adding some 
cycles.

regards,

Marc Mamin

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

Reply via email to