Robert Haas wrote:
On Mon, Dec 7, 2009 at 9:58 PM, Itagaki Takahiro
<itagaki.takah...@oss.ntt.co.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
g...@2ndquadrant.com  www.2ndQuadrant.com

Reply via email to