Re: [HACKERS] [BUGS] BUG #5608: array_agg() consumes too much memory

2010-08-14 Thread Tom Lane
Hitoshi Harada  writes:
> 2010/8/14 Itagaki Takahiro :
>> The attached patch is the near-term fix; it adds ALLOCSET_DEFAULT_INITSIZE
>> bytes to memory assumption.
>> 
>> We might need the same adjustment for string_agg(), that consumes
>> 1024 bytes for the transit condition. array_agg() and string_agg()
>> are only aggregates that have "internal" for aggtranstype.

> So, is it better to generalize as it adds ALLOCSET_DEFAULT_INITSIZE if
> the transtype is internal, rather than specifying individual function
> OID as the patch stands?

I've applied a patch following Hitoshi-san's idea.

BTW, a note about the upthread patch: we don't do manual #define's for
OIDs in pg_proc.h.  Use fmgroids.h for that.

regards, tom lane

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


Re: [HACKERS] [BUGS] BUG #5608: array_agg() consumes too much memory

2010-08-14 Thread Tom Lane
Hitoshi Harada  writes:
> 2010/8/14 Itagaki Takahiro :
>> 2010/8/10 Tom Lane :
>>> Eventually it might be nice to have some sort of way to specify the
>>> estimate to use for any aggregate function --- but for a near-term
>>> fix maybe we should just hard-wire a special case for array_agg in
>>> count_agg_clauses_walker().

> So, is it better to generalize as it adds ALLOCSET_DEFAULT_INITSIZE if
> the transtype is internal, rather than specifying individual function
> OID as the patch stands?

Seems like a good idea ... it's ugly, but it seems much less likely to
need maintenance.

regards, tom lane

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


Re: [HACKERS] [BUGS] BUG #5608: array_agg() consumes too much memory

2010-08-13 Thread Hitoshi Harada
2010/8/14 Itagaki Takahiro :
> 2010/8/10 Tom Lane :
>> Eventually it might be nice to have some sort of way to specify the
>> estimate to use for any aggregate function --- but for a near-term
>> fix maybe we should just hard-wire a special case for array_agg in
>> count_agg_clauses_walker().
>
> The attached patch is the near-term fix; it adds ALLOCSET_DEFAULT_INITSIZE
> bytes to memory assumption.
>
> We might need the same adjustment for string_agg(), that consumes
> 1024 bytes for the transit condition. array_agg() and string_agg()
> are only aggregates that have "internal" for aggtranstype.

So, is it better to generalize as it adds ALLOCSET_DEFAULT_INITSIZE if
the transtype is internal, rather than specifying individual function
OID as the patch stands?

Regards,

-- 
Hitoshi Harada

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


Re: [HACKERS] [BUGS] BUG #5608: array_agg() consumes too much memory

2010-08-13 Thread Itagaki Takahiro
2010/8/10 Tom Lane :
> Eventually it might be nice to have some sort of way to specify the
> estimate to use for any aggregate function --- but for a near-term
> fix maybe we should just hard-wire a special case for array_agg in
> count_agg_clauses_walker().

The attached patch is the near-term fix; it adds ALLOCSET_DEFAULT_INITSIZE
bytes to memory assumption.

We might need the same adjustment for string_agg(), that consumes
1024 bytes for the transit condition. array_agg() and string_agg()
are only aggregates that have "internal" for aggtranstype.

-- 
Itagaki Takahiro


array_agg_memcalc.patch
Description: Binary data

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