Re: psql \watch versus \timing

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql \watch versus \timing
Date: 2014-08-29 09:33:08
Message-ID: 540048D4.5030303@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/28/2014 02:46 PM, Fujii Masao wrote:
> On Tue, Aug 26, 2014 at 4:55 AM, Heikki Linnakangas
> <hlinnakangas(at)vmware(dot)com> wrote:
>> On 08/25/2014 10:48 PM, Heikki Linnakangas wrote:
>>> Actually, perhaps it would be better to just copy-paste PSQLexec, and
>>> modify the copy to suite \watch's needs. (PSQLexecWatch?
>>> SendWatchQuery?). PSQLexec doesn't do much, and there isn't very much
>>> overlap between what \watch wants and what other PSQLexec callers want.
>>> \watch wants timing output, others don't. \watch doesn't want
>>> transaction handling.
>
> Agreed. Attached is the revised version of the patch. I implemented
> PSQLexecWatch() which sends the query, prints the results and outputs
> the query execution time (if \timing is enabled).
>
> This patch was marked as ready for committer, but since I revised
> the code very much, I marked this as needs review again.

This comment:

> ... We use PSQLexecWatch,
> ! * which is kind of cheating, but SendQuery doesn't let us suppress
> ! * autocommit behavior.

is a bit strange now. PSQLexecWatch isn't cheating like reusing PSQLexec
was; it's whole purpose is to run \watch queries.

> /*
> * Set up cancellation of 'watch' via SIGINT. We redo this each time
> * through the loop since it's conceivable something inside PSQLexec
> * could change sigint_interrupt_jmp.
> */

This should now say "PSQLexecWatch".

Other than that, looks good to me.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-08-29 09:38:48 Re: v4 protocol TODO item - Lazy fetch/stream of TOASTed values?
Previous Message Heikki Linnakangas 2014-08-29 09:22:22 Re: implement subject alternative names support for SSL connections