Re: \gexec \watch
От | Alvaro Herrera |
---|---|
Тема | Re: \gexec \watch |
Дата | |
Msg-id | 20181206125618.gtzp4pvkzf7ihobf@alvherre.pgsql обсуждение исходный текст |
Ответ на | Re: \gexec \watch (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: \gexec \watch
Re: \gexec \watch |
Список | pgsql-hackers |
On 2018-Dec-06, Pavel Stehule wrote: > čt 6. 12. 2018 v 12:26 odesílatel Oleksii Kliukin <alexk@hintbits.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. 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
В списке pgsql-hackers по дате отправления: