From: | Kirk Wolak <wolakk(at)gmail(dot)com> |
---|---|
To: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
Cc: | Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, amborodin86(at)gmail(dot)com, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Subject: | Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has) |
Date: | 2023-02-22 18:42:22 |
Message-ID: | CACLU5mQutSYtgwB1ugqaC8f+uqyeN8QgkSn8_3jWqz4owXEp4A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Feb 22, 2023 at 1:14 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> On 22/02/2023 19:59, Nikolay Samokhvalov wrote:
> > On Wed, Feb 22, 2023 at 9:55 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
> > <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> 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
>
> TBH, I have that turned on by default. Load a script. Have 300 of those
lines, and tell me how long it took?
In my case, it's much easier. The other uses cases, including noticing I
changed some configuration and I
should reconnect (because I use multiple sessions, and I am in the early
stages with lots of changes).
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2023-02-22 18:49:42 | Re: Non-superuser subscription owners |
Previous Message | Kirk Wolak | 2023-02-22 18:37:31 | Re: Proposal: %T Prompt parameter for psql for current time (like Oracle has) |