Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SHOW PROCESSLIST/KILL-like feature for PostgreSQL/openGauss databases #20854

Open
2 tasks
strongduanmu opened this issue Sep 7, 2022 · 5 comments
Open
2 tasks

Comments

@strongduanmu
Copy link
Member

strongduanmu commented Sep 7, 2022

Feature Request

Is your feature request related to a problem?

#20299
#19606
#9568

Describe the feature you would like.

In version 5.2.0, ShardingSphere supports MySQL SHOW PROCESSLIST and KILL statements, which makes it more convenient for users to manage SQL.

The following figure shows the execution process of the current SHOW PROCESSLIST statement. It can be seen that it is a general process that can support different types of databases.

show_process_list

So we need to investigate whether PostgreSQL and openGauss databases have statements similar to MySQL SHOW PROCESSLIST/KILL, and then adapt these statements for PostgreSQL and openGauss databases.

@ICannerxy
Copy link
Contributor

I want to do the first requirement .(Adaptation PostgreSQL database)

@strongduanmu
Copy link
Member Author

Welcome @ICannerxy, I will assign this issue to you.

@ICannerxy
Copy link
Contributor

Postgresql supports functions similar to show processlist and kill <processID>.
Use SELECT * FROM pg_stat_activity WHERE state = 'active'; to query running SQL, and use SELECT pg_cancel_backend(<pid of the process>) to kill the running SQL.

@ICannerxy
Copy link
Contributor

  1. create table t1(id integer, name text);
  2. insert into t1 values(1, 'a'); insert into t1 values(2, 'b');

image

> `51293` is pid

image

image

@strongduanmu
Copy link
Member Author

@ICannerxy Can you try with sharding feature, the result looks like PostgreSQL original result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants