Re: setting query timeout as part of the query

Поиск
Список
Период
Сортировка
От William Morgan
Тема Re: setting query timeout as part of the query
Дата
Msg-id CAPE5=AKTezmV0tYSCZei00oXRm+FPG68hiVCdsP3z=vue=gQOg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: setting query timeout as part of the query  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: setting query timeout as part of the query  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
On Tue, Sep 30, 2014 at 1:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
As Steve says, it should be possible to ensure that the pooler doesn't
take the session away from you in between, by wrapping the whole thing
in BEGIN/COMMIT if nothing else.  If the pooler will take away a session
intra-transaction, it is 100% broken and dangerous, and you need to get
another one.
 
I'm using Go's database/sql connection pooling from its stdlib, which does per-transaction pooling and otherwise doesn't expose a whole lot of control to the user. (Presumably to make it something you don't have to think about; yet here I am thinking about it a great deal.)

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.

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.

Thank you both!

-William

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: setting query timeout as part of the query
Следующее
От: Tom Lane
Дата:
Сообщение: Re: setting query timeout as part of the query