Uploaded image for project: 'Apache HAWQ (Retired)'
  1. Apache HAWQ (Retired)
  2. HAWQ-509

Run "select * from pg_stat_activity" returns multiple records for one query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0.0-incubating
    • Catalog
    • None

    Description

      Run a query which contains function will generate multiple records in pg_stat_activity.

      create sequence sri_seq;
      
      create table sri_table (tid bigint, bdate date, aid int, delta int, mtime timestamp) with (appendonly = true, orientation = PARQUET, pagesize = 1048576, rowgroupsize = 8388608, compresstype = SNAPPY)distributed by (tid) ;
      gpsqltest_sri_parquet_part_hash_gpadmin=# begin;
      BEGIN
      gpsqltest_sri_parquet_part_hash_gpadmin=# INSERT INTO sri_table (tid, bdate, aid, delta, mtime) VALUES (nextval('sri_seq'), '1993-10-14', 1, 1, current_timestamp);
      INSERT 0 1
      

      Run ps -ef |grep postgres

      gpadmin  604929 604400 13 01:40 ?        00:00:02 postgres: port  5432, gpadmin gpsqltest_... [local] con38 cmd3 idle in transaction [local]
      gpadmin  604936 604400  1 01:40 ?        00:00:00 postgres: port  5432, gpadmin gpsqltest_... [local] con38 seg-1 idle
      

      Run select from pg_stat_activity, there are two records for single insert. Should only return one record.

      postgres=# select * from pg_stat_activity ;
       datid |                 datname                 | procpid | sess_id | usesysid | usename |          current_query           | waiting |          query_start          |         backend_start         | clie
      nt_addr | client_port | application_name |          xact_start           | waiting_resource
      -------+-----------------------------------------+---------+---------+----------+---------+----------------------------------+---------+-------------------------------+-------------------------------+-----
      --------+-------------+------------------+-------------------------------+------------------
       47622 | gpsqltest_sri_parquet_part_hash_gpadmin |  604936 |      38 |       10 | gpadmin | <IDLE>                           | f       | 2016-01-27 01:40:57.94057-08  | 2016-01-27 01:41:00.132015-08 |
              |          -1 |                  |                               | f
       47622 | gpsqltest_sri_parquet_part_hash_gpadmin |  604929 |      38 |       10 | gpadmin | <IDLE> in transaction            | f       | 2016-01-27 01:40:57.94057-08  | 2016-01-27 01:40:45.784561-08 |
              |          -1 | psql             | 2016-01-27 01:40:50.180561-08 | f
       16387 | postgres                                |  604946 |      40 |       10 | gpadmin | select * from pg_stat_activity ; | f       | 2016-01-27 01:41:22.163617-08 | 2016-01-27 01:41:10.059942-08 |
              |          -1 | psql             | 2016-01-27 01:41:22.163617-08 | f
      (3 rows)
      

      Attachments

        Activity

          People

            lilima Lili Ma
            lilima Lili Ma
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: