mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
I don't like last minute patches before the final freeze, but I believe that
this one could be useful for people experiencing out-of-memory crashes while executing queries which retrieve or use a very large number of tuples. The problem happens when storage is allocated for functions results used in a large query, for example: select upper(name) from big_table; select big_table.array[1] from big_table; select count(upper(name)) from big_table; This patch is a dirty hack that fixes the out-of-memory problem for the most common cases, like the above ones. It is not the final solution for the problem but it can work for some people, so I'm posting it. The patch should be safe because all changes are under #ifdef. Furthermore the feature can be enabled or disabled at runtime by the `free_tuple_memory' options in the pg_options file. The option is disabled by default and must be explicitly enabled at runtime to have any effect. To enable the patch add the follwing line to Makefile.custom: CUSTOM_COPT += -DFREE_TUPLE_MEMORY To enable the option at runtime add the following line to pg_option: free_tuple_memory=1 Massimo
This commit is contained in:
@ -73,6 +73,9 @@ static char *opt_names[] = {
|
||||
"syslog", /* use syslog for error messages */
|
||||
"hostlookup", /* enable hostname lookup in ps_status */
|
||||
"showportnumber", /* show port number in ps_status */
|
||||
#ifdef FREE_TUPLE_MEMORY
|
||||
"free_tuple_memory", /* try to pfree memory for each tuple */
|
||||
#endif
|
||||
|
||||
/* NUM_PG_OPTIONS */ /* must be the last item of enum */
|
||||
};
|
||||
@ -404,9 +407,9 @@ read_pg_options(SIGNAL_ARGS)
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* Local Variables:
|
||||
* tab-width: 4
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
Reference in New Issue
Block a user