Working with metadata

You can work with metadata in Tengri in a number of ways.

System tables

The following system tables are available for the administrator to view.

Table system.schemas

Schemas metadata.

  • catalog_name — catalogue name

  • namespace — schema name

Table system.tables

Tables metadata.

  • catalog_name — catalogue name

  • table_namespace — table schema

  • table_name — table name

  • metadata_location — path to table metadata

  • previous_metadata_location — path to metadata of the previous version of the table

Table system.query_log

History of user queries.

  • id — query identifier

  • username — name of the user executing the query

  • query — query text

  • status — query status

  • started_at — query start time

  • finished_at — the time when the query execution ends

  • duration_ms — query execution duration

  • error_message — error message when executing the query

  • worker_pool — name of the compute pool processing the query

  • worker_id — identifier of the worker processing the query

  • agent_id — identifier of the agent (host for the workers) processing the query

  • session_id — session identifier

  • other

Table system.users

Users metadata.

  • id — user identifier

  • name — user name

  • default_worker_pool — user’s default worker pool

  • auth_method — user authorisation type

  • query_timeout — timeout for user queries

  • spill_size — spill size (the amount of space on disc to save intermediate query results) for the user

  • other

Table system.worker_pools

Metadata of worker pools.

  • id — pool id

  • name — pool name

  • worker_size_id — pool size label

  • max_worker_count — maximum number of calculators for the pool

  • worker_idle_ttl_seconds — the idle time of calculators for the pool

  • scaling_strategy_id — scaling strategy for the pool

Usage examples

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 |
+-------------------+-------------+----------------------------+-----------------------------------------------------+---------+
| ...               | ...         | ...                        | ...                                                 | ...     |
+-------------------+-------------+----------------------------+-----------------------------------------------------+---------+

Let’s output information about all computational pools of size S:

SELECT * FROM system.worker_pools
WHERE worker_size_id = 'S'
+----+-----------+----------------+------------------+-------------------------+---------------------+
| id | name      | worker_size_id | max_worker_count | worker_idle_ttl_seconds | scaling_strategy_id |
+----+-----------+----------------+------------------+-------------------------+---------------------+
| 1  | default   | S              | 10               | 5                       | STD                 |
+----+-----------+----------------+------------------+-------------------------+---------------------+
| 5  | compute_s | S              | 10               | 5                       | STD                 |
+----+-----------+----------------+------------------+-------------------------+---------------------+

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 |
+-----------------------------------------------------+

SHOW expressions

Metadata about various objects can also be retrieved using SHOW expressions:

PostgreSQL system tables

Metadata is also available via the system tables PostgreSQL in the pg_catalog schema:

  • pg_catalog.pg_namespace — Schema metadata.

  • pg_catalog.pg_class — Table metadata.

  • pg_catalog.pg_attribute — Column metadata.

  • pg_catalog.pg_type — Data type metadata.