WIP - Add ability to constrain backend temporary file space

Поиск
Список
Период
Сортировка
От Mark Kirkwood
Тема WIP - Add ability to constrain backend temporary file space
Дата
Msg-id 4D5DE4D8.30000@catalyst.net.nz
обсуждение исходный текст
Ответы Re: WIP - Add ability to constrain backend temporary file space  (Robert Haas <robertmhaas@gmail.com>)
Re: WIP - Add ability to constrain backend temporary file space  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
Recently two systems here have suffered severely with excessive
temporary file creation during query execution. In one case it could
have been avoided by more stringent qa before application code release,
whereas the other is an ad-hoc system, and err...yes.

In both cases it would have been great to be able to constrain the
amount of temporary file space a query could use. In theory you can sort
of do this with the various ulimits, but it seems pretty impractical as
at that level all files look the same and you'd be just as likely to
unexpectedly crippled the entire db a few weeks later when a table grows...

I got to wonder how hard this would be to do in Postgres, and attached
is my (WIP) attempt. It provides a guc (max_temp_files_size) to limit
the size of all temp files for a backend and amends fd.c cancel
execution if the total size of temporary files exceeds this.

This is WIP, it does seem to work ok, but some areas/choices I'm not
entirely clear about are mentioned in the patch itself. Mainly:

- name of the guc... better suggestions welcome
- datatype for the guc - real would be good, but at the moment the nice
parse KB/MB/GB business only works for int

regards

Mark

Вложения

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Replication server timeout patch
Следующее
От: Tom Lane
Дата:
Сообщение: Re: About the performance of startup after dropping many tables