\timing interval

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: \timing interval
Date: 2016-07-07 21:52:15
Message-ID: CADkLM=dbC4R8sbbuFXQVBFWoJGQkTEW8RWnC0PbW9nZsovZpJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

\timing is great.
\timing is helpful.
\timing has made me really good at mentally estimating numbers modulo
3600000.

Wouldn't it be great if we had a way of printing timing in more human
friendly formats?

Attached is a patch that allows the following (new/interesting bits in
bold):

# \timing off
Timing is off.
# select pg_sleep(1);
pg_sleep
----------

(1 row)

# \timing
Timing is on.
# select pg_sleep(1);
pg_sleep
----------

(1 row)

Time: 1002.959 ms
*# \timing interval*
*Timing is interval.*
# select pg_sleep(1);
pg_sleep
----------

(1 row)

*Time: 00:00:01.003*
# \timing
Timing is off.

As demonstrated, "interval" toggles to "off". There is no way to toggle to
"interval".

I'm pretty flexible on how something like this gets invoked. We could leave
timing alone and create a format variable. We could actually leverage the
pre-existing interval-to-string code, etc.

Note: the current patch includes no doc changes. I'd figure I'd wait to do
that after this patch or another gains some traction.

Attachment Content-Type Size
0001-psql-timing-interval.diff text/plain 6.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-07-07 21:56:16 Re: [PATCH] add option to pg_dumpall to exclude tables from the dump
Previous Message Robert Haas 2016-07-07 21:49:27 Re: SELECT DISTINCT never uses an index?