Re: \gexec \watch

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Oleksii Kliukin <alexk(at)hintbits(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 13:03:26
Message-ID: CAFj8pRAsqkeV0JQWX-S8Kk7aPCVJUn+DF6FD7EzxiTsJhg9T8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

čt 6. 12. 2018 v 13:56 odesílatel Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
napsal:

> On 2018-Dec-06, Pavel Stehule wrote:
>
> > čt 6. 12. 2018 v 12:26 odesílatel Oleksii Kliukin <alexk(at)hintbits(dot)com>
> > napsal:
>
> > > 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 -
>
> It is? \gexec \watch is an elegant construct using two existing atoms
> with well-defined semantics. Can't say I see that in \gexec_repeat --
> it seems non-orthogonal to me.
>

Maybe I am wrong, but currently is not possible to compose \ commands.

So you should to introduce new pattern. There is enough long command buffer
to implement it.

Regards

Pavel

> To Oleksii's question, I think if you want to repeat the first query
> over and over, you'd use something like this:
>
> select format('select now() as execution_time, %L as generation_time',
> now()) as query \gset
> :query \watch
>
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2018-12-06 13:13:20 Re: \gexec \watch
Previous Message Alvaro Herrera 2018-12-06 12:56:18 Re: \gexec \watch