Home Database Mysql Tutorial PostgreSQL 列举和停止执行中的 sql

PostgreSQL 列举和停止执行中的 sql

Jun 07, 2016 pm 02:54 PM
postgresql pro sql stop enumerate implement

procpid:进程id start:进程开始时间 lap:经过时间 current_query:执行中的sql 怎样停止正在执行的sql SELECT pg_cancel_backend(进程id); 或者用系统函数 kill -9 进程id; PostgreSQL SELECT procpid, start, now() - start AS lap, current_query FROM

procpid:进程id
start:进程开始时间
lap:经过时间
current_query:执行中的sql

怎样停止正在执行的sql
SELECT pg_cancel_backend(进程id);

或者用系统函数

kill -9 进程id;

PostgreSQL
    SELECT  
        procpid,  
        start,  
        now() - start AS lap,  
        current_query  
    FROM  
        (SELECT  
            backendid,  
            pg_stat_get_backend_pid(S.backendid) AS procpid,  
            pg_stat_get_backend_activity_start(S.backendid) AS start,  
            pg_stat_get_backend_activity(S.backendid) AS current_query  
        FROM  
            (SELECT pg_stat_get_backend_idset() AS backendid) AS S  
        ) AS S  
    WHERE  
        current_query <> '<IDLE>'  
    ORDER BY  
        lap DESC;  
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

Usage of division operation in Oracle SQL Usage of division operation in Oracle SQL Mar 10, 2024 pm 03:06 PM

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Which one is worth buying, Xiaomi Mi Pad 6 or Pro? Which one is worth buying, Xiaomi Mi Pad 6 or Pro? Feb 07, 2024 pm 08:36 PM

Many users are not sure which one is worth buying, Xiaomi Mi Pad 6 or Mi Pad 6. From the configuration point of view, the higher configuration of Pro is definitely recommended, but it also depends on the price and their own budget, and the different product positioning groups are also different. Which one is worth buying, Xiaomi Mi Pad 6 or Pro? Answer: Xiaomi Mi Pad 6 Pro will be better, both in terms of performance and camera battery life. 1. Processor Xiaomi Pad 6: Snapdragon 870 Xiaomi Mi Pad 6 Pro: more powerful first-generation Snapdragon 8+ processor 2. Battery size Xiaomi Mi Pad 6: 8840mAh, 67W second charge Xiaomi Mi Pad 6 Pro: 8600mAh, 33W The fast-charging Xiaomi Mi Pad 6 will have better battery life, but charging will be slower. 3. Take photos with Xiaomi Mi Pad 6

What does the identity attribute in SQL mean? What does the identity attribute in SQL mean? Feb 19, 2024 am 11:24 AM

What is Identity in SQL? Specific code examples are needed. In SQL, Identity is a special data type used to generate auto-incrementing numbers. It is often used to uniquely identify each row of data in a table. The Identity column is often used in conjunction with the primary key column to ensure that each record has a unique identifier. This article will detail how to use Identity and some practical code examples. The basic way to use Identity is to use Identit when creating a table.

Comparison and differences of SQL syntax between Oracle and DB2 Comparison and differences of SQL syntax between Oracle and DB2 Mar 11, 2024 pm 12:09 PM

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Detailed explanation of the Set tag function in MyBatis dynamic SQL tags Feb 26, 2024 pm 07:48 PM

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

How to start Xiaomi Mi Band 8pro How to start Xiaomi Mi Band 8pro Jan 14, 2024 am 08:51 AM

Many users don’t know how to turn on the Xiaomi Mi Band 8 when they first come into contact with it. In fact, the method is very simple. We only need to find the USB data cable and connect the watch to the power supply, and then charge it for a while. You can press the button to turn on. How to turn on Xiaomi Mi Band 8pro 1. First install the watch, that is, connect the theme and the strap on both sides. 2. Then when we turn on the watch for the first time, we need to connect the charging cable. The connection method is at the bottom of the watch. 3. Wait for the watch to vibrate to power on, and then connect to your phone. >>>

The difference between macbook air and pro The difference between macbook air and pro Feb 08, 2024 am 09:57 AM

MacBook Air is an Apple laptop. Many users are curious about the differences between MacBook Air and Pro. These two notebooks have some differences in processor core, main frequency and graphics card type. The differences between MacBook Air and Pro: 1. Different processor cores and threads: MacBook Air's processor has dual cores and four threads. The Pro is more powerful than the MacBook Air, with four cores and eight threads. 2. The main frequency of the processor is different: the processor of MacBook Air has a main frequency of 1.6GHz. The main frequency of the pro's processor is 1.4GHz, which is slightly lower than that of the macbook air. 3. Different graphics cards: macbookair adopts

See all articles