Limit allocated memory per session

Поиск
Список
Период
Сортировка
От daveg
Тема Limit allocated memory per session
Дата
Msg-id 20091001103443.GA32615@sonic.net
обсуждение исходный текст
Ответы Re: Limit allocated memory per session  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Limit allocated memory per session  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
I'd like to propose adding a new GUC to limit the amount of memory a backend
can allocate for its own use. The problem this addresses is that sometimes
one needs to set work_mem fairly high to get good query plans for large joins.
However, some complex queries will then use huge amounts of memory so that
one or a few of them will consume all the memory on the host and run it deep
into swap or trigger the oom killer or worse.

I've attached a patch based on 8.4.1. It works by keeping a track of the
total memory allocated via malloc to AllocBlocks (aset.c). If this is not
shot down/up too badly I will rebase it on CVS and submit it for the next
commit fest.

I would also like to propose a similar limit on temp space use. It is quite
easy for an unintended cartesion product to use hundreds of gigabytes of
scratch space and cause other processes to fail due to lack of disk space.
If this is not objectionable, I'll work on it too.

-dg

--
David Gould       daveg@sonic.net      510 536 1443    510 282 0869
If simplicity worked, the world would be overrun with insects.

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Abhijit Menon-Sen
Дата:
Сообщение: Re: Use "samehost" by default in pg_hba.conf?
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Hot Standby on git