Re: \gexec \watch

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: alexk(at)hintbits(dot)com
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Fetter <david(at)fetter(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: \gexec \watch
Date: 2018-12-06 11:52:34
Message-ID: CAFj8pRBD9tiZY4yWhyy712+xQ5J7QJAj_HknL7kKwu4=a_eGgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

čt 6. 12. 2018 v 12:26 odesílatel Oleksii Kliukin <alexk(at)hintbits(dot)com>
napsal:

>
>
> > On 6. Dec 2018, at 09:01, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
> wrote:
> >
> > On 2018-Dec-06, David Fetter wrote:
> >
> >> There's a bit of a philosophical issue here, or a mathematical one,
> >> whichever way you want to put it. Does it actually make sense to have
> >> the behavior of one "semicolon" spill onto another?
> >
> > Honestly, I don't see the mathematicality in this. It either works, or
> > it doesn't -- and from my POV right now it doesn't. Are you saying we
> > need a \gexecwatch for this to work?
>
> I’ve been trying to do similar stuff with periodic execution of \gexec
> (changing the tablespace of all tables in the given one and retrying, since
> some of them could only get a lock on subsequent attempts) and generally
> reverted to a bash loop outside of psql, but having it built-in would be
> great.
>
> Perhaps a numeric argument to \gexec, i.e. \gexec 5 to re-execute the
> output of a query every 5 seconds?
>

looks not intuitive :)

> The other question is whether such a command would execute the original
> query every time watch is invoked. Consider, e.g. the following one:
>
> select format('select now() as execution_time, %L as generation_time',
> now()) \gexec
> execution_time | 2018-12-06 12:15:24.136086+01
> generation_time | 2018-12-06 12:15:24.13577+01
>
> If we make \gexec + \watch combination re-execute only the output of the
> original query (without the query itself), then the generation time column
> will stay constant through all \watch invocations.
>

It is better to introduce new command like \gexec_repeat with units like
5s, or how much 5x -

Regards

Pavel

>
> Cheers,
> Oleksii
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-12-06 12:44:22 Re: Hint and detail punctuation
Previous Message Michael Paquier 2018-12-06 11:39:02 Re: Hint and detail punctuation