Thread: Execution time
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
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 */
=> 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
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 */