SLOW_LOG is a system table that records Slow SQL queries for the columnar read-only analysis instance, and it resides in the system database libra_system. SQL statements whose execution time exceeds the threshold (300 milliseconds by default) are logged to this table. The system retains Slow SQL execution information for the last 7 days by default, and data beyond this retention period is automatically purged.libra_system.slow_log, the system automatically filters out Slow SQL query records generated by internal users (libra@%) and returns only the query information of business users.succ field.libra_slow_log_threshold.Term | Description | Type | Default Value | Value Range | Unit |
libra_slow_log_threshold | Slow SQL query detection threshold | Integer | 300 | -1 – 9223372036854775807 | Milliseconds |
SET GLOBAL libra_slow_log_threshold = 500;
-1, no Slow SQL queries are logged. The change takes effect immediately without requiring a service restart.sql column is controlled by the system variable libra_query_log_max_len. SQL text that exceeds this length is truncated.Term | Description | Type | Default Value | Value Range | Unit |
libra_query_log_max_len | Maximum length of slow SQL query text | Integer | 4194304 | 0 – 1073741824 | Bytes |
SELECT * FROM libra_system.slow_log;
SELECT start_time, user, db, duration, sqlFROM libra_system.slow_logWHERE duration > 1000ORDER BY duration DESCLIMIT 10;
SELECT start_time, user, db, sql, durationFROM libra_system.slow_logWHERE event_date = '2026-05-13'AND succ = 0;
Field Name | Type | Nullable | Description |
event_date | date | NO | Date when the slow SQL query occurred. Partitioned by date to accelerate time-range filtering. |
start_time | text | NO | The start time of the SQL execution, in the format YYYY-MM-DD HH:MM:SS.ffff, accurate to 0.1 milliseconds. |
tso | bigint(20) unsigned | NO | The transaction timestamp associated with the SQL, which can serve as a globally ordered identifier for queries. |
sql | text | NO | The SQL text information. Its maximum length is controlled by the libra_query_log_max_len parameter (default: 4 MB). Text exceeding this limit will be truncated. |
duration | bigint(20) unsigned | NO | Execution time of the SQL statement, in milliseconds. |
details | text | NO | Detailed information about the SQL execution. This is a reserved field and is currently an empty string. |
conn_id | bigint(20) unsigned | NO | Session ID of the client connection. |
user | text | NO | Username of the user who executed the SQL, in the format user@host. |
db | text | NO | Name of the database where the SQL was executed. |
digest | text | NO | The fingerprint of the normalized SQL. SQL statements with the same pattern share the same Digest, which can be used for aggregated analysis. |
succ | tinyint(3) unsigned | NO | Whether the SQL execution succeeded. Values: 0 indicates failure, and 1 indicates success. |
host | text | NO | Address of the Libra storage node that actually executed the SQL, in the format IP address:Port. |
execution_mode | text | NO | Execution mode of the SQL. Values: no_forward, auto_tp, auto_ap, only_tp, only_ap. For details, see the description below. |
normalized_sql | text | NO | Parameterized (normalized) SQL text, which can be used for SQL pattern aggregation. |
execution_mode Value DescriptionValue | Description |
no_forward | Automatic routing is disabled, and SQL is executed on Libra. |
auto_tp | Automatic routing is enabled, and SQL is routed to TDSQL for execution based on cost estimation. |
auto_ap | Automatic routing is enabled, and SQL is routed to Libra for execution based on cost estimation. |
only_tp | Force route to TDSQL for execution. |
only_ap | Force route to Libra for execution. |
event_date is the partition field of this table, sorted by tso. When querying, prioritize using event_date as a filter condition to significantly improve query performance.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan