PGXC_THREAD_WAIT_STATUS
In PGXC_THREAD_WAIT_STATUS, you can see all the call layer hierarchy relationship between threads of the SQL statements on all the nodes in a cluster, and the waiting status of the block for each thread, so that you can easily locate the causes of process response failures and similar phenomena.
The definitions of PGXC_THREAD_WAIT_STATUS view and PG_THREAD_WAIT_STATUS view are the same, because the essence of the PGXC_THREAD_WAIT_STATUS view is the query summary of the PG_THREAD_WAIT_STATUS view on each node in the cluster.
| Name | Type | Description |
|---|---|---|
| node_name | text | Current node name |
| db_name | text | Database name |
| thread_name | text | Thread name |
| query_id | bigint | Query ID. It is equivalent to debug_query_id. |
| tid | bigint | Thread ID of the current thread |
| sessionid | bigint | Session ID |
| lwtid | integer | Lightweight thread ID of the current thread |
| psessionid | bigint | Parent session ID |
| tlevel | integer | Level of the streaming thread |
| smpid | integer | Concurrent thread ID |
| wait_status | text | Detailed information about the waiting status of the current thread |
| wait_event | text | Event that the current thread is waiting for. For details, see Table 2. |
| locktag | text | Information about the lock that the current thread is waiting for |
| lockmode | text | Lock mode that the current thread is waiting to obtain |
| block_sessionid | bigint | ID of the session that blocks the current thread from obtaining the lock |
| global_sessionid | text | Global session ID |
Example:
If you run a statement on coordinator1 and no response is returned after a long period of time, establish another connection to coordinator1 to check the thread status on it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | gaussdb=# select * from pg_thread_wait_status where query_id > 0; -[ RECORD 1 ]----+-------------------------------------- node_name | cn_5001 db_name | tpcc_row thread_name | PostgreSQL JDBC Driver query_id | 72620544050065400 tid | 140650239031040 sessionid | 11680 lwtid | 26762 psessionid | tlevel | 0 smpid | 0 wait_status | wait node: dn_6007_6008_6009, total 1 wait_event | wait node locktag | lockmode | block_sessionid | global_sessionid | 1120683504:11680#0 gaussdb=# select * from pgxc_thread_wait_status where query_id > 0; -[ RECORD 1 ]----+-------------------------------------------------- node_name | cn_5001 db_name | tpcc_row thread_name | PostgreSQL JDBC Driver query_id | 72620544050081616 tid | 140648290055936 sessionid | 11680 lwtid | 26839 psessionid | tlevel | 0 smpid | 0 wait_status | wait node: dn_6004_6005_6006, total 2 wait_event | wait node locktag | lockmode | block_sessionid | global_sessionid | 1120683504:11680#0 (1 rows) |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.