Re: [SQL] OFFSET impact on Performance???

Поиск
Список
Период
Сортировка
Искать

Re: [SQL] OFFSET impact on Performance???

От:
"Merlin Moncure" <merlin.moncure@rcsonline.com>
Дата:
Greg Stark wrote:
 
> test=> create or replace function array_push (anyarray, anyelement)
> returns anyarray as 'select $1 || $2' language sql immutable strict;
> CREATE FUNCTION
> test=> create aggregate array_aggregate (basetype=anyelement,
> sfunc=array_push, stype=anyarray, initcond = '{}');
> CREATE AGGREGATE

what about 
CREATE AGGREGATE array_accum (
    sfunc = array_append,
    basetype = anyelement,
    stype = anyarray,
    initcond = '{}'
);
?
Merlin

Re: [SQL] OFFSET impact on Performance???

От:
Greg Stark <gsstark@mit.edu>
Дата:

"Merlin Moncure"  writes:

> what about 
> CREATE AGGREGATE array_accum (
>     sfunc = array_append,
>     basetype = anyelement,
>     stype = anyarray,
>     initcond = '{}'
> );

huh, that is faster. It's only 14x slower than the C implementation.

For completeness, here are the fastest times I get after repeating a few times
each:

 13.97 ms 	contrib/intagg C implementation
194.76 ms 	aggregate using array_append
723.15 ms 	aggregate with SQL state function

-- 
greg
FAQ