PostgreSQL Query and/or Session CPU Usage

postgresql

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.

Best 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.