Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-23 Thread Alvaro Herrera
Dmitry Koterov escribió: > I have written in C all needed contrib functions: intarray.bidx() (binary > search in sorted list) and intagg.int_agg_append_state (bufferized appending > of one array to another without linear memory reallocation). The speed now > is great: in one case with intersection

Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-10 Thread Dmitry Koterov
I have written in C all needed contrib functions: intarray.bidx() (binary search in sorted list) and intagg.int_agg_append_state (bufferized appending of one array to another without linear memory reallocation). The speed now is great: in one case with intersection of 10 and 15000 arrays it bec

Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-10 Thread Dmitry Koterov
Wow, seems I've found that! * Beginning in PostgreSQL 8.1, the executor's AggState node is passed as * the fmgr "context" value in all transfunc and finalfunc calls. It is * not really intended that the transition functions will look into the * AggState node, but they can

Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-10 Thread Dmitry Koterov
Thanks for your comment. I see two possible solution directions: 1. Is it possible to create C-function, which could accept something like ROWSET(ARRAY[]) in its input parameters? E.g. to call it as SELECT array_rowset_glue((SELECT arrayfield FROM arraytable)); or something like this? 2. Is

Re: [GENERAL] How to speedup intarray aggregate function?

2007-10-09 Thread Filip Rembiałkowski
2007/10/10, Dmitry Koterov <[EMAIL PROTECTED]>: > Hello. > > I created an aggregate: > > CREATE AGGREGATE intarray_aggregate_push (_int4) > ( > STYPE = _int4, > SFUNC = intarray_push_array, > INITCOND = '{}' > ); > > (or - I may use _int_union instead of intarray_push_array, its speed is > pr

[GENERAL] How to speedup intarray aggregate function?

2007-10-09 Thread Dmitry Koterov
Hello. I created an aggregate: CREATE AGGREGATE intarray_aggregate_push (_int4) ( STYPE = _int4, SFUNC = intarray_push_array, INITCOND = '{}' ); (or - I may use _int_union instead of intarray_push_array, its speed is practically the same in my case). This aggregate merges together a list o