hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lil...@apache.org
Subject [2/2] incubator-hawq git commit: HAWQ-509. Change pg_stat_activity definition, only returns one record for one query
Date Fri, 11 Mar 2016 01:46:58 GMT
HAWQ-509. Change pg_stat_activity definition, only returns one record for one query


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/cda5c66c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/cda5c66c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/cda5c66c

Branch: refs/heads/master
Commit: cda5c66ce488e0b212cabdbefb19137f872fcce3
Parents: 88bf600
Author: Lili Ma <lma@pivotal.io>
Authored: Thu Mar 10 14:16:44 2016 +0800
Committer: Lili Ma <lma@pivotal.io>
Committed: Fri Mar 11 09:46:32 2016 +0800

----------------------------------------------------------------------
 src/backend/catalog/system_views.sql | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/cda5c66c/src/backend/catalog/system_views.sql
----------------------------------------------------------------------
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index 8ba0a51..4895672 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -355,9 +355,19 @@ CREATE VIEW pg_stat_activity AS
             S.application_name,
             S.xact_start,
 			S.waiting_resource
-    FROM pg_database D, pg_stat_get_activity(NULL) AS S, pg_authid U
+    FROM pg_database D, pg_stat_get_activity(NULL) AS S, pg_authid U,
+         (
+              SELECT
+                  sess_id,
+                  min(backend_start) AS min_backend_start
+              FROM 
+                  pg_stat_get_activity(NULL)
+              GROUP BY 
+                  sess_id)S2
     WHERE S.datid = D.oid AND 
-            S.usesysid = U.oid;
+          S.usesysid = U.oid AND
+          S.sess_id = S2.sess_id AND
+          S.backend_start = S2.min_backend_start;
 
 CREATE VIEW pg_stat_database AS 
     SELECT 


Mime
View raw message