Re: EXPLAIN BUFFERS

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Euler Taveira de Oliveira <euler(at)timbira(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: EXPLAIN BUFFERS
Date: 2009-12-08 04:09:18
Message-ID: 4B1DD16E.1030406@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas wrote:
> On Mon, Dec 7, 2009 at 9:58 PM, Itagaki Takahiro
> <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>
>> Obviously I should not hide any information only in the text format.
>> The new output will be: (in one line)
>> Shared Blocks: (hit=2 read=1641 written=0) Local Blocks: (hit=0 read=0 written=0) Temp Blocks: (read=1443 written=1443)
>>
>
> Hmm, that's a little awkward. I think we could drop some of the punctuation.
>
> Shared Blocks: hit 2 read 1641 wrote 0, Local Blocks: hit 0 read 0
> wrote 0, Temp Blocks: read 1443 wrote 1443
>
Having written more things to parse log files that should have been
saved in a better format after the fact than I'd like, I'd say that
replacing the "=" signs used as a delimiter with a space is a step
backwards. That doesn't save any space anyway, and drifts too far from
what one gets out of regular EXPLAIN I think.

I was perfectly happy with proposed text format as being a reasonable
trade-off between *possible* to parse if all you have is the text
format, while still being readable. If you want to compress
horizontally, get rid of "Blocks" after the first usage is the first
thing to do:

(1) Blocks Shared: (hit=2 read=1641 written=0) Local: (hit=0 read=0
written=0) Temp: (read=1443 written=1443)

That's already at about the same length as what you suggested at 105
characters, without losing any useful formatting.

If further compression is required, you could just remove all the
parentheses:

(2) Blocks Shared:hit=2 read=1641 written=0 Local:hit=0 read=0 written=0
Temp:read=1443 written=1443

I don't really like this though. Instead you could abbreviate the rest
of the repeated text and reduce the number of spaces:

(3) Blocks Shared:(hit=2 read=1641 written=0) Local:(h=0 r=0 w=0)
Temp:(r=1443 w=1443)

And now we're at the smallest result yet without any real loss in
readability--I'd argue it's faster to read in fact. This has a good
balance of fitting on a reasonably wide console (the above is down to 82
characters), still being readable to anyone, and being possible to
machine parse in a pinch if all you have are text logs around (split on
: then =). It might be too compressed down for some tastes though.

--
Greg Smith 2ndQuadrant Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-12-08 04:16:19 Re: EXPLAIN BUFFERS
Previous Message 黄晓骋 2009-12-08 04:05:45 questions about concurrency control in Postgresql