Re: Allow default \watch interval in psql to be configured

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Allow default \watch interval in psql to be configured
Date: 2024-10-10 07:43:27
Message-ID: FC0C250D-8C47-4A42-B262-2FDCA5B47590@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 10 Oct 2024, at 02:01, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Wed, Oct 09, 2024 at 04:24:27PM +0200, Daniel Gustafsson wrote:
>> Fixed.
>
> - double sleep = 2;
> + double sleep = pset.watch_interval;
>
> This forces the use of seconds as unit. The interval values I have
> been using a lot myself are between 0.2s and 0.5s because I usually
> want a lot more granularity in my lookups than the 1s interval. Could
> it be better to allow values lower than 1s or let this value be a
> string with optional "s" or "ms" units?

I'm not sure I follow, it's true that the unit is seconds but the patch doesn't
change the ability to use fractions of a second that we already support today.

db=# \echo :WATCH_INTERVAL
2
db=# \set WATCH_INTERVAL 0.1
db=# \echo :WATCH_INTERVAL
0.1
db=# select 1;
?column?
----------
1
(1 row)

danielg=# \watch
Thu Oct 10 09:32:05 2024 (every 0.1s)

?column?
----------
1
(1 row)

Thu Oct 10 09:32:05 2024 (every 0.1s)

?column?
----------
1
(1 row)

Or did I misunderstand your email?

We could support passing in an optional unit, and assume the unit to be seconds
if none was used, but it doesn't really fit nicely with the current API we have
so I wonder if the added complexity is worth it?

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2024-10-10 08:06:11 Re: Wrong results with grouping sets
Previous Message Daniel Gustafsson 2024-10-10 07:30:41 Re: Converting tab-complete.c's else-if chain to a switch