Re: psql \watch versus \timing
От | Fujii Masao |
---|---|
Тема | Re: psql \watch versus \timing |
Дата | |
Msg-id | CAHGQGwGF0U1qWmTNBMHZ3Mk2_uN5r2Nuf3KvObksgkDPJ=0JOA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: psql \watch versus \timing (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: psql \watch versus \timing
|
Список | pgsql-hackers |
On Mon, May 20, 2013 at 7:33 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Jeff Janes <jeff.janes@gmail.com> writes: >> I'd like to run same query repeatedly and see how long it takes each time. >> I thought \watch would be excellent for this, but it turns out that using >> \watch suppresses the output of \timing. > >> Is this intentional, or unavoidable? > > \watch uses PSQLexec not SendQuery; the latter implements \timing which > I agree is arguably useful here, but also autocommit/auto-savepoint > behavior which probably isn't a good idea. > > It might be a good idea to refactor those two routines into one routine > with some sort of bitmap flags argument to control the various add-on > behaviors, but that seems like not 9.3 material anymore. Attached patch changes \watch so that it displays how long the query takes if \timing is enabled. I didn't refactor PSQLexec and SendQuery into one routine because the contents of those functions are not so same. I'm not sure how much it's worth doing that refactoring. Anyway this feature is quite useful even without that refactoring, I think. BTW, I found that \watch doesn't check for async notifications. Is it useful to allow \watch to do that? ISTM that it's not so bad idea to use \timing to continuously check for async notifications. No? Regards, -- Fujii Masao
Вложения
В списке pgsql-hackers по дате отправления: