maas_db=# SELECT
pss.userid,
pss.dbid,
pd.datname as db_name,
round((pss.total_exec_time + pss.total_plan_time)::numeric, 2) as total_time,
pss.calls,
round((pss.mean_exec_time+pss.mean_plan_time)::numeric, 2) as mean,
round((100 * (pss.total_exec_time + pss.total_plan_time) / sum((pss.total_exec_time + pss.total_plan_time)::numeric) OVER ())::numeric, 2) as cpu_portion_pctg,
substr(pss.query, 1, 200) short_query
FROM pg_stat_statements pss, pg_database pd
WHERE pd.oid=pss.dbid
ORDER BY (pss.total_exec_time + pss.total_plan_time)
DESC LIMIT 30;
userid | dbid | db_name | total_time | calls | mean | cpu_portion_pctg | short_query
--------+--------+---------+------------+-------+-------+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
16384 | 118108 | maas_db | 21.26 | 2 | 10.63 | 17.92 | UPDATE "maasserver_staticipaddress" SET "created" = $1::timestamp, "updated" = $2::timestamp, "ip" = $3::inet, "alloc_type" = $4, "subnet_id" = $5, "user_id" = $6, "lease_time" = $7, "temp_expires_on"
10 | 118108 | maas_db | 12.45 | 3 | 4.15 | 10.49 | SELECT +
| | | | | | | pss.userid, +
| | | | | | | pss.dbid, +
| | | | | | | pd.datname as db_name, +
| | | | | | | round((pss.total_exec_time + pss.total_plan_time)::numeric, $1) as total_time, +
| | | | | | | pss.calls, +
| | | | | | | round((pss.mean_exec_time+pss.mean_plan_time)::nu
16384 | 118108 | maas_db | 10.64 | 90 | 0.12 | 8.97 | SELECT "maasserver_node"."id", "maasserver_node"."created", "maasserver_node"."updated", "maasserver_node"."system_id", "maasserver_node"."hardware_uuid", "maasserver_node"."hostname", "maasserver_nod
16384 | 118108 | maas_db | 10.23 | 6 | 1.71 | 8.62 | UPDATE "maasserver_neighbour" SET "updated" = $1::timestamp, "time" = $2, "count" = $3 WHERE "maasserver_neighbour"."id" = $4
16384 | 118108 | maas_db | 7.78 | 39 | 0.20 | 6.56 | SET TIME ZONE 'UTC'
16384 | 118108 | maas_db | 5.34 | 8 | 0.67 | 4.50 | SELECT DISTINCT "maasserver_node"."id", "maasserver_node"."created", "maasserver_node"."updated", "maasserver_node"."system_id", "maasserver_node"."hardware_uuid", "maasserver_node"."hostname", "maass
16384 | 118108 | maas_db | 4.47 | 1 | 4.47 | 3.77 | SELECT "maasserver_vlan"."id", ("maasserver_vlan"."primary_rack_id" IS NOT NULL AND "maasserver_vlan"."secondary_rack_id" IS NOT NULL) AS "is_ha" FROM "maasserver_vlan"
16384 | 118108 | maas_db | 2.51 | 1 | 2.51 | 2.12 | UPDATE "maasserver_controllerinfo" SET "created" = $1::timestamp, "updated" = $2::timestamp, "version" = $3, "update_version" = $4, "update_origin" = $5, "update_first_reported" = $6, "install_type" =
16384 | 118108 | maas_db | 1.94 | 17 | 0.11 | 1.64 | SELECT "maasserver_node"."id", "maasserver_node"."created", "maasserver_node"."updated", "maasserver_node"."system_id", "maasserver_node"."hardware_uuid", "maasserver_node"."hostname", "maasserver_nod
16384 | 118108 | maas_db | 1.74 | 72 | 0.02 | 1.47 | SELECT "maasserver_regioncontrollerprocessendpoint"."id", "maasserver_regioncontrollerprocessendpoint"."created", "maasserver_regioncontrollerprocessendpoint"."updated", "maasserver_regioncontrollerpr
16384 | 118108 | maas_db | 1.71 | 80 | 0.02 | 1.44 | SELECT "maasserver_service"."id", "maasserver_service"."created", "maasserver_service"."updated", "maasserver_service"."node_id", "maasserver_service"."name", "maasserver_service"."status", "maasserve
16384 | 118108 | maas_db | 1.67 | 16 | 0.10 | 1.41 | SELECT "maasserver_node"."id", "maasserver_node"."created", "maasserver_node"."updated", "maasserver_node"."system_id", "maasserver_node"."hardware_uuid", "maasserver_node"."hostname", "maasserver_nod
16384 | 118108 | maas_db | 1.53 | 1 | 1.53 | 1.29 | SELECT DISTINCT ON (fqdn, is_boot, family) +
| | | | | | | CONCAT(node.hostname, $1, domain.name) AS fqdn, +
| | | | | | | node.system_id, +
| | | | | | | node.node_type, +
| | | | | | | staticip.user
16384 | 118108 | maas_db | 1.31 | 1 | 1.31 | 1.11 | SELECT DISTINCT ON (fqdn, is_boot, family) +
| | | | | | | CONCAT(node.hostname, $1, domain.name) AS fqdn, +
| | | | | | | node.system_id, +
| | | | | | | node.node_type, +
| | | | | | | staticip.user
16384 | 118108 | maas_db | 1.31 | 28 | 0.05 | 1.10 | SELECT "maasserver_staticipaddress"."id", "maasserver_staticipaddress"."created", "maasserver_staticipaddress"."updated", "maasserver_staticipaddress"."ip", "maasserver_staticipaddress"."alloc_type",
16384 | 118108 | maas_db | 1.25 | 1 | 1.25 | 1.05 | SELECT "maasserver_event"."id", "maasserver_event"."created", "maasserver_event"."updated", "maasserver_event"."type_id", "maasserver_event"."node_id", "maasserver_event"."node_system_id", "maasserver
16384 | 118108 | maas_db | 1.25 | 18 | 0.07 | 1.05 | SELECT "maasserver_node"."id", "maasserver_node"."created", "maasserver_node"."updated", "maasserver_node"."system_id", "maasserver_node"."hardware_uuid", "maasserver_node"."hostname", "maasserver_nod
16384 | 118108 | maas_db | 1.18 | 1 | 1.18 | 0.99 | SELECT +
| | | | | | | COALESCE(dnsrr.fqdn, node.fqdn) AS fqdn, +
| | | | | | | node.system_id, +
| | | | | | | node.node_type, +
| | | | | | | staticip.user_id, +
| | | | | | | +
| | | | | | | COALE
16384 | 118108 | maas_db | 1.05 | 16 | 0.07 | 0.89 | SELECT "maasserver_service"."id", "maasserver_service"."created", "maasserver_service"."updated", "maasserver_service"."node_id", "maasserver_service"."name", "maasserver_service"."status", "maasserve
16384 | 118108 | maas_db | 1.02 | 6 | 0.17 | 0.86 | SELECT "maasserver_interface"."id", "maasserver_interface"."created", "maasserver_interface"."updated", "maasserver_interface"."node_config_id", "maasserver_interface"."name", "maasserver_interface"."
16384 | 118108 | maas_db | 1.01 | 2 | 0.50 | 0.85 | SELECT DISTINCT ON ("maasserver_scriptresult"."script_name", "maasserver_scriptresult"."physical_blockdevice_id", "maasserver_scriptresult"."interface_id", "maasserver_scriptset"."node_id") "maasserve
16384 | 118108 | maas_db | 1.00 | 1 | 1.00 | 0.84 | SELECT +
| | | | | | | CONCAT(node.hostname, $1, domain.name) AS fqdn, +
| | | | | | | node.system_id, +
| | | | | | | node.node_type, +
| | | | | | | node.owner_id AS user_id, +
| | | | | | | +
| | | | | | |
16384 | 118108 | maas_db | 0.94 | 53 | 0.02 | 0.79 | SELECT "maasserver_config"."id", "maasserver_config"."name", "maasserver_config"."value" FROM "maasserver_config" WHERE "maasserver_config"."name" = $1 LIMIT $2
16384 | 118108 | maas_db | 0.92 | 6 | 0.15 | 0.77 | SELECT "maasserver_interface"."id", "maasserver_interface"."created", "maasserver_interface"."updated", "maasserver_interface"."node_config_id", "maasserver_interface"."name", "maasserver_interface"."
16384 | 118108 | maas_db | 0.88 | 6 | 0.15 | 0.74 | SELECT "maasserver_neighbour"."id", "maasserver_neighbour"."created", "maasserver_neighbour"."updated", "maasserver_neighbour"."ip", "maasserver_neighbour"."time", "maasserver_neighbour"."vid", "maass
16384 | 118108 | maas_db | 0.87 | 48 | 0.02 | 0.73 | SELECT "maasserver_regionrackrpcconnection"."id", "maasserver_regionrackrpcconnection"."created", "maasserver_regionrackrpcconnection"."updated", "maasserver_regionrackrpcconnection"."endpoint_id", "m
16384 | 118108 | maas_db | 0.87 | 1 | 0.87 | 0.73 | SELECT +
| | | | | | | CONCAT(node.hostname, $1, domain.name) AS fqdn, +
| | | | | | | node.system_id, +
| | | | | | | node.node_type, +
| | | | | | | node.owner_id AS user_id, +
| | | | | | | +
| | | | | | |
16384 | 118108 | maas_db | 0.85 | 1 | 0.85 | 0.72 | SELECT "maasserver_node"."id", "maasserver_node"."created", "maasserver_node"."updated", "maasserver_node"."system_id", "maasserver_node"."hardware_uuid", "maasserver_node"."hostname", "maasserver_nod
16384 | 118108 | maas_db | 0.83 | 12 | 0.07 | 0.70 | SELECT COUNT(*) AS "__count" FROM "maasserver_node" WHERE ("maasserver_node"."node_type" IN ($1, $2) AND NOT (EXISTS(SELECT ($3) AS "a" FROM "maasserver_regioncontrollerprocess" U1 WHERE (U1."id" IN (
16384 | 118108 | maas_db | 0.83 | 12 | 0.07 | 0.70 | UPDATE "maasserver_regioncontrollerprocess" SET "created" = $1::timestamp, "updated" = $2::timestamp, "region_id" = $3, "pid" = $4 WHERE "maasserver_regioncontrollerprocess"."id" = $5
(30 rows)