out of memory with large queries - Mailing list pgsql-hackers

From Massimo Dal Zotto
Subject out of memory with large queries
Date
Msg-id 199906092036.WAA29474@fandango.cs.unitn.it
Whole thread Raw
Responses Re: [HACKERS] out of memory with large queries
List pgsql-hackers
Hi,

I have a problem with large queries: I have a table with 300000 rows and
when I try the following query the backends runs out of memory:
 select upper(name) from my_table;

The following queries without funcs or with funcs of int4 work fine:
 select name from my_table; select max(id,0) from my_table;

so I suspect that the trouble is with memory allocated by functions
returning data by address, which is not released until the end of the
transaction. With more then 300000 rows you eat a lot of memory.

This means that postgres is currently unable to execute large queries
that involve functions on text fields. A pretty bad limitation IMHO.

I tried to look at the code but haven't found a way to release the
storage allocated for each tuple and the context allocation code is
not very documented.

Any suggestion?

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+


pgsql-hackers by date:

Previous
From: Goran Thyni
Date:
Subject: Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem
Next
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] Priorities for 6.6