-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance: Add warehouse_id to pg_stat_activity_extended
We add new catalog view pg_stat_activity_extended to map query/session to warehouse in cloud. We report warehouse_id in pgstat_report_activity for each query.
- Loading branch information
1 parent
4649bc4
commit d73da65
Showing
8 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- pg_stat_activity_extended is only used in cloud with warehouse | ||
-- In CBDB, pg_stat_activity_extended warehouse_id should always be NULL | ||
|
||
create table test_activity(a int); | ||
CREATE | ||
|
||
0: insert into test_activity select * from generate_series(1,100); | ||
INSERT 100 | ||
|
||
-- in CBDB QD/QE warehouse_id must be NULL | ||
|
||
SELECT warehouse_id, query from pg_stat_activity_extended WHERE query LIKE 'insert into test_activity select * from generate_series(1,100);'; | ||
warehouse_id | query | ||
--------------+----------------------------------------------------------------- | ||
| insert into test_activity select * from generate_series(1,100); | ||
(1 row) | ||
|
||
SELECT warehouse_id, query from gp_dist_random('pg_stat_activity_extended') WHERE query LIKE 'insert into test_activity select * from generate_series(1,100);' limit 1; | ||
warehouse_id | query | ||
--------------+----------------------------------------------------------------- | ||
| insert into test_activity select * from generate_series(1,100); | ||
(1 row) | ||
|
||
drop table test_activity; | ||
DROP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- pg_stat_activity_extended is only used in cloud with warehouse | ||
-- In CBDB, pg_stat_activity_extended warehouse_id should always be NULL | ||
|
||
create table test_activity(a int); | ||
|
||
0: insert into test_activity select * from generate_series(1,100); | ||
|
||
-- in CBDB QD/QE warehouse_id must be NULL | ||
|
||
SELECT warehouse_id, query from pg_stat_activity_extended WHERE query LIKE 'insert into test_activity select * from generate_series(1,100);'; | ||
|
||
SELECT warehouse_id, query from gp_dist_random('pg_stat_activity_extended') WHERE query LIKE 'insert into test_activity select * from generate_series(1,100);' limit 1; | ||
|
||
drop table test_activity; |