Thread: Execution time

Execution time

From
Shiby Thomas
Date:
Hi,

In postgres, is there a way to get the CPU time and I/O time taken (separately)
to execute a query? Does the profile info. help in some way to
calculate the CPU/IO break up at least approximately.

What is the best way to do it? Any kind of help is greatly appreciated.

Thanks
--shiby



Re: [HACKERS] Execution time

From
Mattias Kregert
Date:
Shiby Thomas wrote:
>
> Hi,
>
> In postgres, is there a way to get the CPU time and I/O time taken (separately)
> to execute a query? Does the profile info. help in some way to
> calculate the CPU/IO break up at least approximately.
>
> What is the best way to do it? Any kind of help is greatly appreciated.
>
> Thanks
> --shiby

How about running "time postgres ..." and connecting to the backend
without using the postmaster?

/* m */

Re: [HACKERS] Execution time

From
Shiby Thomas
Date:
=> How about running "time postgres ..." and connecting to the backend
=> without using the postmaster?
=>
The time command will give the elapsed, user CPU and System CPU times.
How do I interpret it as CPU/IO time ?

Even the -s option of postgres gives those times. Will it be the same as
using "time postgres" ? Is the System time a reasonable approximation of the
I/O time and user time that of CPU time ?

Thanks
--shiby



Re: [HACKERS] Execution time

From
Mattias Kregert
Date:
Shiby Thomas wrote:
>
> The time command will give the elapsed, user CPU and System CPU times.
> How do I interpret it as CPU/IO time ?
>
> Even the -s option of postgres gives those times. Will it be the same as
> using "time postgres" ? Is the System time a reasonable approximation of the
> I/O time and user time that of CPU time ?


I would say they are reasonable approximations, at least for
user==CPU.
Perhaps you need to look at elapsed time too, and from that make some
assumptions about I/O waiting time. I think system time will be lower
if you use SCSI and higher with IDE.
I would count (elapsed time - CPU time) as I/O time.

/* m */