public inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Nikolay Samokhvalov <[email protected]>
To: Tom Lane <[email protected]>
To: Kirk Wolak <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Pavel Stehule <[email protected]>
Cc: [email protected]
Cc: Laurenz Albe <[email protected]>
Subject: Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)
Date: Wed, 22 Feb 2023 20:14:54 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANNMO+KqqM0YpVUmVDec+9nku9ai9T=Y5Tp=pZ0rp1jR3d8kqA@mail.gmail.com>
References: <CACLU5mSRwHr_8z=enMj-nXF1tmC7+Jn5heZQNiKuLyxYUtL2fg@mail.gmail.com>
	<[email protected]>
	<CANNMO+KqqM0YpVUmVDec+9nku9ai9T=Y5Tp=pZ0rp1jR3d8kqA@mail.gmail.com>

On 22/02/2023 19:59, Nikolay Samokhvalov wrote:
> On Wed, Feb 22, 2023 at 9:55 AM Tom Lane <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     On the whole I'd rather not eat more of the limited namespace for
>     psql prompt codes for this.
> 
> 
> It depends on personal preferences. When I work on a large screen, I can 
> afford to spend some characters in prompts, if it gives convenience – 
> and many do (looking, for example, at modern tmux/zsh prompts showing 
> git branch context, etc).
> 
> Default behavior might remain short – it wouldn't make sense to extend 
> it for everyone.

I have no objections to adding a %T option, although deciding what 
format to use is a hassle. -1 for changing the default.

But let's look at the original request:

> This has been in sqlplus since I can remember, and I find it really
> useful when I forgot to time something, or to review for Time spent
> on a problem, or for how old my session is...
I've felt that pain too. You run a query, and it takes longer than I 
expected. How long did it actually take? Too bad I didn't enable \timing 
beforehand..

How about a new backslash command or psql variable to show how long the 
previous statement took? Something like:

postgres=# select <unexpectedly slow query>
  ?column?
----------
       123
(1 row)

postgres=# \time

Time: 14011.975 ms (00:14.012)

This would solve the "I forgot to time something" problem.

- Heikki







view thread (14+ 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]
  Subject: Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has)
  In-Reply-To: <[email protected]>

* 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