Re: Are indexes blown?

From: "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>
To: "Andrej Ricnik-Bay" <andrej(dot)groups(at)gmail(dot)com>
Cc: "PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>, "Greg Smith" <gsmith(at)gregsmith(dot)com>
Subject: Re: Are indexes blown?
Date: 2008-02-16 19:55:17
Message-ID: e373d31e0802161155s44f35737lfabf081bab8faf1d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 17/02/2008, Andrej Ricnik-Bay <andrej(dot)groups(at)gmail(dot)com> wrote:
> On 16/02/2008, Greg Smith <gsmith(at)gregsmith(dot)com> wrote:
>
> > top -bc | tee topdata
> >
> > That will save everything to a file called topdata while also letting you
> > watch it scroll by. Not as easy to catch the bad periods that way, the
> > output is going to be a huge data file, but you'll have a log to sort
> > through of everything. Control-C to get out of there when you're bored.
>
> Or pipe through the following awk-script to make the output
> less overwhelming ... save it as top.awk
>
> BEGIN{
> # the sort numerically sorts by memory usage percentage
> # head filters out the top 20 contenders
> command = "LC_ALL=C sort -k 10,10gr|head -20"
> }
> {
> # read all of top into an array
> line[NR]=$0
> last=NR
> }
> END{
> # print the header well-formed
> for(i=1;i<8;i++){
> print line[i]
> }
> # and do the sort & strip of the processes
> for(i=8;i<last;i++){
> print line[i]|& command
> }
> close(command, "to")
> while ((command |& getline out) > 0)
> print out
> close(command)
> }
>
> Invoke like so
> top -b -d 1 | awk -f top.awk | tee topdata
>
> Instead of the "getting bored Ctrl-C" maybe a "-n 3600" as
> extra parameter to top to get roughly one hours worth of data...

Thanks, but it gives me syntax errors:

~> top -b -d 1 | awk -f top.awk | tee topdata

awk: top.awk:24: for(i=8;i<last;i++
awk: top.awk:24: ^ syntax error
awk: top.awk:28:
awk: top.awk:28: ^ syntax error
awk: top.awk:29:
awk: top.awk:29: ^ syntax error
awk: top.awk:31:
awk: top.awk:31: ^ syntax error
awk: top.awk:31: }
awk: top.awk:31: ^ invalid char '' in expression

Any ideas?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Phoenix Kiula 2008-02-16 20:20:01 Re: Are indexes blown?
Previous Message Andrej Ricnik-Bay 2008-02-16 19:47:55 Re: Are indexes blown?