public inbox for [email protected]  
help / color / mirror / Atom feed
From: Gurjeet Singh <[email protected]>
To: Kirk Wolak <[email protected]>
Cc: Maciek Sakrejda <[email protected]>
Cc: Nikolay Samokhvalov <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Heikki Linnakangas <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Pavel Stehule <[email protected]>
Cc: Andrey Borodin <[email protected]>
Cc: Laurenz Albe <[email protected]>
Subject: Re: Proposal: :SQL_EXEC_TIME (like :ROW_COUNT) Variable (psql)
Date: Thu, 23 Feb 2023 23:11:38 -0800
Message-ID: <CABwTF4U+N5oi2TmWzCEAVpWb5kM3V4jqcLFczDhcPypTrkqejQ@mail.gmail.com> (raw)
In-Reply-To: <CACLU5mQKvCHUaCx_yooZJZ=Ud1Bddux48j7C2xF0cNQC8AqVQg@mail.gmail.com>
References: <CACLU5mSRwHr_8z=enMj-nXF1tmC7+Jn5heZQNiKuLyxYUtL2fg@mail.gmail.com>
	<[email protected]>
	<CANNMO+KqqM0YpVUmVDec+9nku9ai9T=Y5Tp=pZ0rp1jR3d8kqA@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAOtHd0D28EgtwVKw+AUeEiH9Ai+-vUZH=PtCePBgpDp0WBY93Q@mail.gmail.com>
	<CANNMO++GPeo3v7DELX02stRqWcJGdAbkh3i04m5Vc5nC3kkHng@mail.gmail.com>
	<CAOtHd0B8+FHsNKVGy8Bg39MX31eg2UpTUd1NxexZgVvOs-WUaA@mail.gmail.com>
	<CACLU5mQKvCHUaCx_yooZJZ=Ud1Bddux48j7C2xF0cNQC8AqVQg@mail.gmail.com>

On Thu, Feb 23, 2023 at 8:42 PM Kirk Wolak <[email protected]> wrote:
>   I love that my proposal for %T in the prompt, triggered some great conversations.
>
>   This is not instead of that.  That lets me run a query and come back HOURS later, and know it finished before 7PM like it was supposed to!

Neat! I have this info embedded in my Bash prompt [1], but many a
times this is not sufficient to reconstruct the time it took to run
the shell command.

>   This feature is simple.  We forget to set \timing on...
> We run a query, and we WONDER... how long did  that take.

And so I empathize with this need. I have set my Bash prompt to show
me this info [2].This info is very helpful in situations where you
fire a command, get tired of waiting for it and walk away for a few
minutes. Upon return it's very useful to see exactly how long did it
take for the command to finish.

>   I am not sure the name is right, but I would like to report it in the same (ms) units as \timing, since there is an implicit relationship in what they are doing.
>
>   I think like ROW_COUNT, it should not change because of internal commands.

+1

> So, you guys +1 this thing, give additional comments.  When the feedback settles, I commit to making it happen.

This is definitely a useful feature. I agree with everything in the
proposed UI (reporting in milliseconds, don't track internal commands'
timing).

I think 'duration' or 'elapsed' would be a better words in this
context. So perhaps the name could be one of :sql_exec_duration (sql
prefix feels superfluous), :exec_duration, :command_duration, or
:elapsed_time.

By using \timing, the user is explicitly opting into any overhead
caused by time-keeping. With this feature, the timing info will be
collected all the time. So do consider evaluating the performance
impact this can cause on people's workloads. They may not care for the
impact in interactive mode, but in automated scripts, even a moderate
performance overhead would be a deal-breaker.

[1]: https://github.com/gurjeet/home/blob/08f1051fb854f4fc8fbc4f1326f393ed507a55ce/.bashrc#L278
[2]: https://github.com/gurjeet/home/blob/08f1051fb854f4fc8fbc4f1326f393ed507a55ce/.bashrc#L262

Best regards,
Gurjeet
http://Gurje.et






view thread (18+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Proposal: :SQL_EXEC_TIME (like :ROW_COUNT) Variable (psql)
  In-Reply-To: <CABwTF4U+N5oi2TmWzCEAVpWb5kM3V4jqcLFczDhcPypTrkqejQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox