Viewing system tables

The following system tables are available for viewing by the administrator:

  • system.query_log — history of user queries (query text, status, execution time, execution duration, etc.)

  • system.users — user information (name, current working pool, authorization type, etc.)

  • system.worker_pools — working pool information (name, size, maximum number of workers, scaling strategy, etc.)

Usage example

Let’s display all queries made by user tengri_user between December 21 and 23, 2025 with their duration, start time, session ID, and status:

SELECT
    query,
    duration_ms,
    started_at,
    session_id,
    status
FROM system.query_log
WHERE username = 'tengri_user'
    AND started_at BETWEEN '2025-12-21' AND '2025-12-23'
+-------------------+-------------+----------------------------+-----------------------------------------------------+---------+
| query             | duration_ms | started_at                 | session_id                                          | status  |
+-------------------+-------------+----------------------------+-----------------------------------------------------+---------+
| select * from ... | 2526        | 2026-04-13T16:21:31.686087 | f77b9a65-588d-46de-bdcb-07d1cf1f3ba1@localhost:5433 | success |
+-------------------+-------------+----------------------------+-----------------------------------------------------+---------+
| ...               | ...         | ...                        | ...                                                 | ...     |
+-------------------+-------------+----------------------------+-----------------------------------------------------+---------+

Getting current session ID

To get the current session ID, use the current_session() function.

SELECT current_session();
+-----------------------------------------------------+
| current_session                                     |
+-----------------------------------------------------+
| f77b9a65-588d-46de-bdcb-07d1cf1f3ba1@localhost:5433 |
+-----------------------------------------------------+