grayhemp / pgtoolkit

Tools for PostgreSQL maintenance
Other
184 stars 16 forks source link

Max execution time #7

Open kustodian opened 9 years ago

kustodian commented 9 years ago

Since pgcompact is used as a database maintenance tool, you usually have a limited time when you can do maintenance (e.g. when there is less db activity), so it would be really nice if you could define a max execution time which would limit how long pgcompact can run. For example --max-execution-time=3600 which would limit execution to 1 hour.

grayhemp commented 9 years ago

It makes sense. However, I guess it would be better to override SIGINT to stop pgcompact correctly, eg. wait for an ongoing query or process to finish, like the reindex one, instead of just breaking it in the middle, what might lead to unpleasant side effects like not dropped temporary indexes. So one could either safely Ctrl+C pgcompact or schedule kill <pid> or killall pgcompact on a particular time when the inactivity window ends for example (kill and killall use SIGINT by default). That would be more general and more flexible.

Thoughts?

kustodian commented 9 years ago

I agree, that would be a much better option. We randomly encounter pgcompact temp tables and indices all the time, and they shouldn't exist.

On Tue, Mar 31, 2015, 03:24 Sergey Konoplev notifications@github.com wrote:

It makes sense. However, I guess it would be better to override SIGINT to stop pgcompact correctly, eg. wait for an ongoing query or process to finish, like the reindex one, instead of just breaking it in the middle, what might lead to unpleasant side effects like not dropped temporary indexes. So one could either safely Ctrl+C pgcompact or schedule kill

or killall pgcompact on a particular time when the inactivity window ends for example (kill and killall use SIGINT by default). That would be more general and more flexible. Thoughts? — Reply to this email directly or view it on GitHub https://github.com/grayhemp/pgtoolkit/issues/7#issuecomment-87957721.
grayhemp commented 9 years ago

Putting it down to my TODO then.

BTW, pgcompact does not create temp tables, only indexes.

kustodian commented 9 years ago

Yeah, sorry, you are correct, only indices.

On Tue, Mar 31, 2015, 11:58 Sergey Konoplev notifications@github.com wrote:

Putting it down to my TODO then.

BTW, pgcompact does not create temp tables, only indexes.

— Reply to this email directly or view it on GitHub https://github.com/grayhemp/pgtoolkit/issues/7#issuecomment-88120700.