Boszormenyi Zoltan <z...@cybertec.at> writes:
> It means that StatementTimeout losts its precision. It would trigger
> in the future counting from "now" instead of counting from
> GetCurrentStatementStartTimestamp().

That is, in fact, better not worse.  Note the comment in the existing
code:

         * Begin statement-level timeout
         *
         * Note that we compute statement_fin_time with reference to the
         * statement_timestamp, but apply the specified delay without any
         * correction; that is, we ignore whatever time has elapsed since
         * statement_timestamp was set.  In the normal case only a small
         * interval will have elapsed and so this doesn't matter, but there
         * are corner cases (involving multi-statement query strings with
         * embedded COMMIT or ROLLBACK) where we might re-initialize the
         * statement timeout long after initial receipt of the message. In
         * such cases the enforcement of the statement timeout will be a bit
         * inconsistent.  This annoyance is judged not worth the cost of
         * performing an additional gettimeofday() here.

That is, measuring from GetCurrentStatementStartTimestamp is a hack to
save one gettimeofday call, at the cost of making the timeout less
accurate, sometimes significantly so.  In the new model there isn't any
good way to duplicate this kluge (in particular, there's no point in
using enable_timeout_at, because that will still make a gettimeofday
call).  That doesn't bother me too much.  I'd rather try to buy back
whatever performance was lost by seeing if we can reduce the number of
setitimer calls.

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to