From: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
---|---|
To: | Jessica Blank <jb(at)twu(dot)net> |
Cc: | Joe Conway <mail(at)joeconway(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Measuring CPU time use? (Another stupid question) |
Date: | 2002-12-18 20:02:46 |
Message-ID: | Pine.LNX.4.33.0212181301150.3807-100000@css120.ihs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
But you realize that the time it took to run the query is NOT the same as
the CPU time, right? A heavy table with 100,000,000 rows may use only a
tiny percentage of CPU but take a minute to return, while your I/O
subsystem thrashes away dmaing the data into memory where it gets copied
to output in 30 milliseconds of CPU time.
Look for iostat to analyze your I/O load, which is often the greater load
factor for a db server than CPU use.
On Wed, 18 Dec 2002, Jessica Blank wrote:
> Thanky thanky. That might work.
>
> Still, I'd rather just have a way I could get a plain old figure.
>
> E.g.:
>
> DELETE FROM V$CPUUSE;
> (DO THE QUERIES IN QUESTION HERE)
> SELECT NANOSECONDS_USED FROM V$CPUUSE;
>
> On Wed, 18 Dec 2002, Joe Conway wrote:
>
> > Jessica Blank wrote:
> > > I wish to find a way to measure the CPU time used by any given query (or
> > > set of queries).
> > >
> > > I could not find any information on how to do this...
> > >
> > > Is there some secret internal table (like the V$ virtual tables in Oracle)
> > > that contains this info?
> >
> > Well, I don't know of anything specific to CPU usage, but for monitoring your
> > server see Monitoring Database Activity in the manual:
> > http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/monitoring.html
> >
> > Also, one of the best and most commonly used tools for optimizing individual
> > queries is EXPLAIN ANALYZE; see:
> > http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/sql-explain.html
> >
> > HTH,
> >
> > Joe
> >
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jessica Blank | 2002-12-18 20:06:35 | Re: ERROR: fmgr_info: function 24809: cache lookup failed |
Previous Message | scott.marlowe | 2002-12-18 20:00:07 | Re: ORDER BY random() LIMIT 1 slowness |