Обсуждение: Explain Output made Colorful

Поиск
Список
Период
Сортировка

Explain Output made Colorful

От
"Ian Harding"
Дата:
I have a hard time looking at explain output, so I cobbled together this script to generate HTML with certain things
highlightedin colors of your choosing.  Please note that I know as much shelll scripting as I do Swahili. 

If you can boil it down into a 5 line script, please do!

Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: iharding@tpchd.org

We have only two things to worry about:  That things will never get
back to normal, and that they already have.



Вложения

Re: Explain Output made Colorful

От
Adrian 'Dagurashibanipal' von Bidder
Дата:
On Mon, 2002-08-19 at 21:27, Ian Harding wrote:
> I have a hard time looking at explain output, so I cobbled together this script to generate HTML with certain things
highlightedin colors of your choosing.  Please note that I know as much shelll scripting as I do Swahili. 

Cool idea. thanks.

Note on the color scheme. People often think red=bad, green=good.
Perhaps a more neutral coloring would be appropriate - seqscan is not
bad, pg choses seqscan because it thinks it would be faster, after all.
(If there is an index available, of course).

cheers
-- vbi

--
secure email with gpg                         http://fortytwo.ch/gpg

Вложения

Re: Explain Output made Colourful

От
"Arguile"
Дата:
I apologise if this is a duplicate, my MTA is really acting up and I haven't
seen it on the list. Incase it was the size of the attachments they're now
located here ( http://lucentstudios.com/pg/ ).

http://lucentstudios.com/pg/sample.html

Ian Harding wrote on August 19, 2002:
>
> I have a hard time looking at explain output, so I cobbled
> together this script to generate HTML with certain things
> highlighted in colors of your choosing.  Please note that I know
> as much shell scripting as I do Swahili.
>
> If you can boil it down into a 5 line script, please do!

I did a quick rewrite, but then fell prey to feature creep ;). So it's now
in Perl and produces HTML tables. It takes EXPLAIN output on STDIN and is
configured through a stylesheet.

    pgsql -U user -D database -c "EXPLAIN query" 2>&1 |
    ./explain > out.html

Or just call it with a text file:

    perl explain in.txt out.html

The sample is a bit doctored as I embedded the stylesheet in it so people
could preview from email if they wanted. Output HTMLs require the CSS
(Cascading Style Sheet) to be in the same dir as them by default.

It doesn't use any modules (which means it's icky embedded HTML ;) so it
should work on any *nix system by default. Pretty rough but should work.

Have fun.