This topic describes how to execute the SHOW BINARY LOGS statement to query the binary log files of a PolarDB-X instance.

Syntax

SHOW BINARY LOGS [WITH stream_name];

Usage notes

  • Before you execute the preceding SQL statement, make sure that your account is granted the SUPER or REPLICATION CLIENT permission. For information about how to manage permissions, see Manage accounts and permissions.
  • If the SQL statement does not contain a WITH clause, the binary log files generated in single-stream mode are returned.
  • If the SQL statement contains a WITH clause, the binary log files generated for the specified stream in multi-stream mode are returned. The stream_name parameter specifies the name of the stream.
  • For more information about the SQL statement, see SHOW BINARY LOGS.

Example 1

Execute the following statement to query the binary log files generated in single-stream mode:

SHOW BINARY LOGS;

The following result is returned:

+---------------+-----------+
| LOG_NAME      | FILE_SIZE |
+---------------+-----------+
| binlog.000001 |         4 |
+---------------+-----------+

Example 2

Execute the following statement to query the binary log files generated for the group1_stream_0 stream:

SHOW BINARY LOGS WITH 'group1_stream_0';

The following result is returned:

+-------------------------------+-----------+
| LOG_NAME                      | FILE_SIZE |
+-------------------------------+-----------+
| group1_stream_0#binlog.000001 |   3626808 |
+-------------------------------+-----------+