Is there any way in PostgreSQL to know how much the cpu cost was per a query and/or by session. It doesn't have to be the exact system cpu usage more of a relative cost like we get with disk I/O. For Windows or Linux.
1 Answer
The auto_explain
module might be what you are looking for.
The statistics collector is probably the closest you can get to the Oracle v$ views.
Some more might be available in the pg_stat_statements
extension.
-
That looks interesting, but I don't see it giving any CPU usage. Really something like v$mystat which Oracle has would be ideal. Jan 23, 2012 at 22:09
-
Sorry, I misread "cost" as "cost from the execution plan". See my edit for other options. Jan 23, 2012 at 22:16
-
The problem with all of those is they just give a general cost or in some cases the amount of io cost performed which is nice, but it's really nice to compare two solutions and see how much the io and the cpu are different at the sql statement, session, and transaction level. Jan 23, 2012 at 22:40
-
As you can reset the stats between running two statements you should at least be able to get the IO stats. Jan 24, 2012 at 10:32