query column in pg_stat_statements and pg_stat_activity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've written the below SQL query that joins pg_stat_statements with pg_stat_activity using "queryid" as the join condition. Yet, the results show that pg_stat_statements and pg_stat_activity are reporting two distinct queries for the identical queryid. Can this occur?

select

pgss.queryid as "PGSS_QUERYID",

pgss.query as "PGSS_QUERY",

pgsa.query_id as "PGSA_QUERYID",

substring(pgsa.query,

1,

45) as "PGSA_QUERY"

from

pg_stat_statements pgss

join pg_stat_activity pgsa on

pgss.queryid = pgsa.query_id

and pgss.queryid = '2397681704071010949';


    PGSS_QUERYID     | PGSS_QUERY |    PGSA_QUERYID     |                  PGSA_QUERY
---------------------+------------+---------------------+-----------------------------------------------
 2397681704071010949 | BEGIN      | 2397681704071010949 | select projectper0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select projectper0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 |  SELECT item_guid, count(item_guid) count  FR
 2397681704071010949 | BEGIN      | 2397681704071010949 |  SELECT item_guid, count(item_guid) count  FR
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | SELECT distinct ep.role FROM v_project_permis
 2397681704071010949 | BEGIN      | 2397681704071010949 | SELECT distinct ep.role FROM v_project_permis
 2397681704071010949 | BEGIN      | 2397681704071010949 | select this_.CONTACT_SID as CONTACT1_362_1_,
 2397681704071010949 | BEGIN      | 2397681704071010949 | select this_.CONTACT_SID as CONTACT1_362_1_,
 2397681704071010949 | BEGIN      | 2397681704071010949 |  SELECT item_guid,category,root_guid, count(i
 2397681704071010949 | BEGIN      | 2397681704071010949 |  SELECT item_guid,category,root_guid, count(i
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as
 2397681704071010949 | BEGIN      | 2397681704071010949 | select folderperm0_.ENTITY_PERMISSION_SID as

Regards,

Satalabha

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux