[HACKERS] O(n^2) aggregates

2007-12-10 Thread Gregory Stark
I was trying to test my patch to do posix_fadvise to speed up bitmap heap scans (with disappointing results so far) and ran into a bit of a gotcha. I'm not sure where this should be documented but it probably should be somewhere. In order to test bitmap heap scan I had to build an array and use

Re: [HACKERS] O(n^2) aggregates

2007-12-10 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes: The solution to this would analogous to what we did to count(). We would need to add a field to ArrayMetaState which is stored in fn_extra to remember the last array returned. Then if array_push notices it has been called from an aggregate context it can

Re: [HACKERS] O(n^2) aggregates

2007-12-10 Thread Pavel Stehule
Hello select count(*) from huge where h = any ((select arrayize( (1+random()*3)::integer ) from generate_series(1,1000) )::integer[]) select array(select (1+random()*3):: integer from generate_series(1,4)); Time: 111,807 ms