Re: setting query timeout as part of the query - Mailing list pgsql-novice

From Tom Lane
Subject Re: setting query timeout as part of the query
Date
Msg-id 21688.1412113157@sss.pgh.pa.us
Whole thread Raw
In response to Re: setting query timeout as part of the query  (William Morgan <william@introhq.com>)
Responses Re: setting query timeout as part of the query  (William Morgan <william@introhq.com>)
List pgsql-novice
William Morgan <william@introhq.com> writes:
> If I understand you both correctly, wrapping every statement in a
> transaction will have no appreciable difference in speed or level of
> concurrency, since that wrapping would otherwise already happen under the
> hood. Since the Go pooler respects transactions, that seems like the answer
> to me.

Right.

> And if the execution of the set command itself turns out to be costly
> (though that sounds unlikely) there is a backup plan involving a series of
> user accounts with different timeouts that will at least allow me to
> approximate the limits that I want.

It shouldn't be terribly costly.  One thing you might consider, if you're
wrapping the statements in transactions anyway, is to use SET LOCAL whose
effects won't last beyond the transaction.  I don't think this will make
any notable difference speed-wise, but it just seems a tad cleaner if the
timeouts don't persist.

            regards, tom lane


pgsql-novice by date:

Previous
From: William Morgan
Date:
Subject: Re: setting query timeout as part of the query
Next
From: William Morgan
Date:
Subject: Re: setting query timeout as part of the query