This article is half-done without your Comment! *** Please share your thoughts via Comment ***
PostgreSQL 9.6 introduced new two columns of table pg_stat_activity. The columns are wait_event_type and wait_event.
The column wait_event_type reports the type of event a backend is waiting for, and the wait_event which is the name of the event being waiting for. These both columns are very useful for finding a query event information.
Please check small demonstration of this:
Create a sample table:
1 |
CREATE TABLE tbl_students(rno int, name character varying(10)); |
Put your table in lock mode:
1 2 |
BEGIN TRANSACTION; LOCK tbl_students IN ACCESS EXCLUSIVE MODE; |
Open a new query session, and try to insert a below record:
1 |
INSERT INTO tbl_students VALUES (1,'Anvesh'); |
Open a new query session, and check the output of pg_stat_activity:
1 |
SELECT query, wait_event_type, wait_event FROM pg_stat_activity |
Leave a Reply