Re: Intervening in Parser -> Planner Stage - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Intervening in Parser -> Planner Stage
Date
Msg-id 17423.1015354027@sss.pgh.pa.us
Whole thread Raw
In response to Intervening in Parser -> Planner Stage  ("Arguile" <arguile@lucentstudios.com>)
List pgsql-hackers
"Arguile" <arguile@lucentstudios.com> writes:
> I'm currently pursuing a line of thought on resource limiting, and I'd like
> some opinions on whether it's possible/probable.

These seem like fairly indirect ways of limiting resource usage.  Why
not instead set a direct limit on the amount of runtime allowed?

Postgres doesn't use the ITIMER_VIRTUAL (CPU time) timer, so about all
you'd need issetitimer(ITIMER_VIRTUAL, &itimer, NULL);
to a suitable limit before starting query execution, and cancel it again
at successful query end.  Set the SIGVTALRM signal handler to
QueryCancelHandler (same as SIGINT), and voila.  A direct solution in
about ten lines of code ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Postgresql backend to perform vacuum automatically
Next
From: Thomas Lockhart
Date:
Subject: Re: Mandrake RPMs uploaded