0

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

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. – Kuberchaun Jan 23 '12 at 22:09
  • Sorry, I misread "cost" as "cost from the execution plan". See my edit for other options. – a_horse_with_no_name Jan 23 '12 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. – Kuberchaun Jan 23 '12 at 22:40
  • As you can reset the stats between running two statements you should at least be able to get the IO stats. – a_horse_with_no_name Jan 24 '12 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.