This topic describes how to use the SHOW PROCESSLIST and SHOW PHYSICAL_PROCESSLIST statements.

SHOW PROCESSLIST

You can execute the following statement to view the connections in PolarDB-X 1.0 and the SQL statements being executed.

  • Syntax
    SHOW PROCESSLIST
  • Example
    mysql> SHOW PROCESSLIST\G
         ID: 1971050
       USER: admin
       HOST: 111.111.111.111:4303
         DB: drds_test
    COMMAND: Query
       TIME: 0
      STATE: 
       INFO: show processlist
    1 row in set (0.01 sec)
    Field Description
    ID The ID of the connection. The value is a long-type number.
    USER The user name used to establish this connection.
    HOST The IP address and port number of the host that establishes the connection.
    DB The name of the database accessed by this connection.
    COMMAND This field can be set to the either of the following values:
    • Query: The current connection is executing an SQL statement.
    • Sleep: The current connection is idle.
    TIME It is the duration when the connection is in the current state.
    • When the value of COMMAND is Query, this field indicates how long the SQL statement has been executed on the connection.
    • When the value of COMMAND is Sleep, this field indicates how long the connection has been idle.
    STATE This field is meaningless and is constantly empty.
    INFO
    • When the value of COMMAND is Query, this field indicates the content of the SQL statement that is being executed on the connection.
      Note If the FULL parameter is not specified, SHOW PROCESSLIST returns the first 30 characters of each SQL statement that is being executed. If the FULL parameter is specified, SHOW PROCESSLIST returns the first 1,000 characters of each SQL statement that is being executed.
    • If the value of the COMMAND is Sleep, this field is meaningless and is empty.

SHOW PHYSICAL_PROCESSLIST

You can execute the following statement to view information about all physical SQL statements that are being executed.

  • Syntax
    SHOW PHYSICAL_PROCESSLIST
    Note When an SQL statement in the returned results of the SHOW PHYSICAL_PROCESSLIST statement is excessively long, the SQL statement is truncated. In this case, you can execute the SHOW FULL PHYSICAL_PROCESSLIST statement to query the complete SQL statement.
  • Example
    mysql> SHOW PHYSICAL_PROCESSLIST\G
    *************************** 1. row ***************************
               ID: 0-0-521414
             USER: tddl5
               DB: tddl5_00
          COMMAND: Query
             TIME: 0
            STATE: init
             INFO: show processlist
    *************************** 2. row ***************************
               ID: 0-0-521570
             USER: tddl5
               DB: tddl5_00
          COMMAND: Query
             TIME: 0
            STATE: User sleep
             INFO: /*DRDS /88.88.88.88/b67a0e4d8800000/ */ select sleep(1000)
    2 rows in set (0.01 sec)
    Note
    • The meaning of each column in the returned results is equivalent to that of the SHOW PROCESSLIST statement in MySQL. For more information, see SHOW PROCESSLIST Syntax.
    • Different from ApsaraDB RDS for MySQL, the PolarDB-X 1.0 instance returns a string instead of a number in the ID column of a physical connection.