Re: \timing interval

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: \timing interval
Date: 2016-07-09 22:28:02
Message-ID: 0b43d73d-2c93-2089-58a5-3d3078959dd2@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/07/16 08:00, Andrew Gierth wrote:
>>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> > Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> >> I'm not quite sure what you mean by wanting to do arithmetic on the
> >> numbers. My phrasing of the problem is that after a long query, you
> >> might get output like this:
> >> Time: 1234567.666 ms
> >> which is pretty useless.
>
> Tom> What I mean by that is that not infrequently, I'll run the same
> Tom> query several times and then want to average the results. That's
> Tom> easy with awk or similar scripts as long as the numbers are in
> Tom> straight decimal.
>
> Tom> I don't mind if we provide a way to print in Babylonian-inspired
> Tom> notation(s) as well, but I'm going to be seriously annoyed if
> Tom> that's the only way to get the output.
>
> How about
>
> Time: 1234567.666 ms (20m 34.6s)
>
> ?
>
I like that, but I think the human form should retain the 3 decimal places.

In a few years, we may well have enormously multiprocessor computers
with massive very fast permanent 'RAM' where the entire database is
always in memory, so timing to the nearest microsecond could be useful.
Obviously microsecond precision would be silly now, and would probably
never warrant being the default (I'd be happy to be proved wrong here!),
but it might be worthwhile putting in as an option - while people are
looking at the relevant areas of the code.

Am inspired by the man page for 'ls': [...] The SIZE argument is an
integer and optional unit (example: 10K is 10*1024). Units are
K,M,G,T,P,E,Z,Y (powers of 1024) [...]" Obviously learnt from the
lessons of "640KB should be enough for everyone" stupidity!

Cheers,
Gavin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2016-07-10 00:08:15 Re: \timing interval
Previous Message Peter Geoghegan 2016-07-09 21:43:41 Re: \timing interval