Конференция Arenadata
ArenaTech 2026 – для всех, кому интересны технологии Big Data
Приглашаем вас принять участие в технической онлайн-конференции, посвященной работе с большими данными. Участие бесплатно для всех желающих.

В программе 3 блока докладов:

  • СУБД: архитектура и эксплуатация. Обсудим новые возможности Greengage DB и Arenadata DB на его основе, включая hot standby, обзор утилиты изменения кластерной топологии ggrebalance, вопросы безопасности и устранения CVE.
  • Платформа данных: безопасность и Kubernetes в ADH, аналитика в ADQM. Расскажем об управлении секретами и доступом в Arenadata Hyperwave с использованием OpenBao, особенности переноса сервисов в Kubernetes, а также про аналитические методы в инструментах ADQM.
  • Инструменты: кластерный менеджер, документация, ИИ-поиск. Поделимся опытом разработки технической документации (включая интеллектуальный поиск и ИИ-ассистент) и поговорим про развитие нашего кластерного менеджера ADCM.
Онлайн-конференция состоится 29 октября 2026 года, время трансляции: с 12:00 до 19:00 по московскому времени.
Осталось до события

SQL cells

A new SQL cell contains the SQL query editor and control panel. After the query is executed, query execution statistics (QUERY STATS) and query results panel (or the Error panel, if an error occurred during the query execution) are added to the cell.

SQL cell
SQL cell
SQL cell
SQL cell

When created, a new notebook contains one SQL cell.

Query text

The SQL query editor provides the following functionality:

  • SQL syntax highlighting.

  • Line numbering (can be enabled/disabled in the settings, see below). Clicking a line number selects the entire line.

  • Autocompletion — when you type an SQL query, a list of possible keywords, clauses, functions, database/table/column names is displayed based on the characters already entered. This feature can be enabled/disabled by the corresponding setting; and even if it is turned off, you can open suggestions by pressing Ctrl+Space.

  • Automatic closing of brackets and quotation marks as you type (controlled by the corresponding setting).

  • Automatic increasing/decreasing the editor based on the size of the SQL code. The editor can also be resized manually by dragging its bottom border. Double-clicking the resize handle at the bottom of the editor returns it to the size determined automatically depending on the size of the query text.

SQL query editor
SQL query editor
SQL query editor
SQL query editor

Beautify SQL

Use the beautify sql icon dark beautify sql icon light Beautify SQL icon to automatically make your query code more readable as follows:

  • use consistent indents and spaces to structure the code logically;

  • place major clauses (such as SELECT, FROM, WHERE, JOIN, etc.) on separate lines;

  • use uppercase for all SQL keywords (for example, SELECT, AS, FROM, GROUP BY, ORDER BY);

  • break long lists of columns to be selected into lines — one column per line.

NOTE

Beautify SQL applies formatting to the query text based on the results of EXPLAIN SYNTAX, so the ClickHouse server should be available for this functionality to work.

Use the Beautify SQL option
Use the Beautify SQL option
Use the Beautify SQL option
Use the Beautify SQL option
Example of applying Beautify SQL

The code of the query shown in the image above, after applying the Beautify SQL option, will look like the following.

Formatted query text
Formatted query text
Отформатированный текст запроса
Formatted query text

Query editor settings

For the query text editor in an SQL cell, you can configure the following parameters (to open the window with settings, click the settings icon dark settings icon light Settings icon in the upper right corner of the interface):

  • Font Size — font size (the setting does not affect text cells);

  • Word Wrap — enables/disables line wrapping (in text cells, line wrapping is always enabled, regardless of this setting);

  • Line Numbers — enables/disables line numbering (in text cells, row numbering can only be enabled for editing mode);

  • Auto-Close Brackets & Quotes — enables/disables automatic closing of brackets and quotation marks as you type;

  • SQL Autocomplete — enables/disables automatic display of suggestions for completing keywords, functions, database/table/column names as you type SQL code.

Settings
Settings
Settings
Settings

Variables in queries

In the VARIABLES panel, you can add variables as key/value pairs. In a query, you can reference a variable by a key using the {{variable_name}} format — this entry will be automatically replaced with the variable’s value before submitting the query to be executed. Variables use case-insensitive matching (for example, {{MyVar}}, {{myvar}}, {{MYVAR}} all match the same variable).

Use a variable in a query
Use a variable in a query
Use a variable in a query
Use a variable in a query

The VARIABLES panel header displays a count of added variables on the right. If you add a variable with a duplicate name, the corresponding fields are highlighted in red, the variable count is not incremented, and the value of the duplicate variable is ignored.

Control panel

The SQL cell control panel, located above the query text editor, contains the following elements:

  • drag to order icon dark drag to order icon light Drag to reorder — drag and drop to move a cell relative to others within a notebook.

  • [n] — monotonically increasing cell creation identifier that does not change when the cell is moved or deleted.

  • settings icon dark settings icon light Query settings — display settings that allow specifying limits to prevent the execution of a potentially resource-intensive query. Available settings:

    • max_memory_usage — maximum amount of RAM for executing a query on a server;

    • max_execution_time — maximum query execution time;

    • max_threads — maximum number of threads that can be used simultaneously during query execution;

    • join_algorithm — algorithm to perform JOINs.

    These settings (except for the join algorithm) can also be specified for all queries at the notebook level. However, limits set within an SQL cell have a higher priority.

  • beautify sql icon dark beautify sql icon light Beautify SQL — apply automatic formatting to the query text.

  • AI icon dark AI icon light AI — convert a text question into a SELECT SQL query (available if the Text-to-SQL service is installed in an ADQM cluster).

  • Query execution status:

    query status grey icon dark query status grey icon light — query has not been executed yet;

    query status yellow icon dark query status yellow icon light — query is currently being executed;

    query status green icon dark query status green icon light — query has been executed successfully;

    query status red icon dark query status red icon light — query execution has been failed.

    For a query that has been executed (successfully or with an error), the time the query was last run is also shown next to the status indicator.

  • n statements — number of queries in a cell (shown if a cell contains more than one query separated by semicolons).

  • run history icon dark run history icon light n — history of query runs in a cell (shown if more than one run was performed; n — number of runs in the history).

  • run icon Run — start query execution.

  • toggle query icon dark toggle query icon light Toggle query — collapse/expand the query code editor (if the editor is collapsed, the beginning of the query text is displayed within the control panel).

  • screenshot icon dark screenshot icon light Copy cell as image — copy a cell as an image.

  • expand all queries icon dark expand all queries icon light Fullscreen — expand an SQL cell to full screen (or collapse it).

  • copy query icon dark copy query icon light Duplicate cell — copy a cell.

  • move up icon dark move up icon light Move up — move a cell one position above the previous one.

  • move down icon dark move down icon light Move down — move a cell one position below the next one.

  • add cell below icon dark add cell below icon light Add cell below — create a new cell of the same type below.

  • delete cell icon dark delete cell icon light Delete cell — delete a cell.

SQL cell control panel
SQL cell control panel
SQL cell control panel
SQL cell control panel

Query execution

To run a query, do one of the following:

  • Click run icon Run in the control panel of the corresponding SQL cell. While a query is running, the Run button visually changes to Stop — clicking it cancels the query execution (KILL QUERY is sent).

  • Click an SQL cell to select it (a selected cell is highlighted in green) and press Ctrl+Enter (or Cmd+Enter).

Run a query
Run a query
Run a query
Run a query

In the ADQM Notebook interface, multiple SQL cells can execute their queries simultaneously when running individually. The run all icon command executes queries in cells sequentially from top to bottom waiting for each query to complete before running the next one.

Run all queries in a notebook
Run all queries in a notebook
Run all queries in a notebook
Run all queries in a notebook

Using the Max Rows per Query parameter in ADQM Notebook’s settings, you can set the maximum number of rows in query results for a cell. When the limit is reached, a query is interrupted (KILL QUERY is sent), and the results are marked as truncated.

Query execution is also interrupted when you switch to another notebook or click Clear Results.

Query results panel

After executing a query, the results are displayed in the results panel, which contains the Table and Chart tabs, where you can view the resulting data as a grid or chart, respectively. The results panel also contains:

  • general information on the query results (number of received data rows and execution time);

  • Search results…​ field, which allows you to filter data in the result set in real time by any column — the panel will show only the values that match the specified filter;

  • download icon dark download icon light Download icon, which you can use to save the query results in one of the supported formats (CSV, TSV, JSON, JSONLines, Parquet).

    CSV, TSV, JSON, and JSONLines are generated on the client side from cached results. Parquet re-runs the entire query on the ADQMDB server because it requires server-side format generation. This means:

    • A query may return different results if data changed.

    • Additional server load is possible.

The results panel can be collapsed/expanded with the icon toggle query icon dark toggle query icon light in the upper left corner.

Query results panel
Query results panel
Query results panel
Query results panel

To clear the query results of all SQL cells in a notebook, open the Clear context menu in the notebook control panel and select Clear Results.

Clear results of queries
Clear results of queries
Clear results of queries
Clear results of queries

Error panel

If an error occurs during query execution, a corresponding message is displayed in the Error panel (instead of the results panel).

Query execution error
Query execution error
Query execution error
Query execution error

History of query runs

If a query (or set of queries) was run more than once in a cell, you can use the run history icon dark run history icon light Run history feature to compare runs or switch to previous ones.

The RUN HISTORY pop-up window displays the last five query runs in a cell; at the bottom — comparison of the current run with the one selected in the history. To switch to one of the previous runs, click restore in the corresponding history entry — the query text, results, and execution plan received from the previous run (without re-executing the query) will be loaded into the cell.

History of query runs in a cell
History of query runs in a cell
History of query runs in a cell
History of query runs in a cell

Results table

After executing a query, an SQL cell displays the resulting data set on the Table tab as an interactive data grid, which supports the following features for easy viewing of the received data:

  • Displaying column names and data types in headers.

  • Sorting data by clicking any column header.

  • Data search — filtering values in the result set by any column in real time using the Search results…​ field.

  • Smart formatting:

    • numeric columns are aligned to the right, text columns are aligned to the left;

    • URLs are automatically detected and converted into clickable links;

    • NULL values are visually different from others;

    • JSON data is formatted;

    • arrays and JSON objects can be collapsed/expanded (the default behavior is controlled by the Expand JSON/Arrays by default option in the interface settings — this option affects the display of the results of newly executed queries; already displayed results will not be collapsed/expanded when the option is switched);

    • summary information on columns as labels in headers: the proportion of NULL values in a column (if 0% — a green label, if more than 0% — a red label), the number of unique values in a column, the range of values in numeric and DateTime columns.

Query results table
Query results table
Query results table
Query results table
NOTE

The maximum number of cells (rows * columns) per result set is 100000 to prevent browser crashes.

Query results chart

You can also view the numerical results of your queries as charts. To do this, open the Chart tab in the results panel and configure the following parameters to build a chart:

  • TYPE — chart type (line icon dark line icon light Line, area icon dark area icon light Area, or bar icon dark bar icon light Bar);

  • X-AXIS — a column whose values will be used for labels on the X axis;

  • Y-AXIS — one or more columns whose values will be used for labels on the Y axis.

On both axes, a chart is built between the minimum and maximum values from the query results.

Query results as charts
Query results as charts
Query results as charts
Query results as charts

A chart displays a maximum of 2000 points due to downsampling. If downsampling is applied, the note downsampled to N of M points is shown, while the results table still contains all rows.

Query execution plan

For a SELECT query (including if it uses CTE), the results panel provides the Plan tab with the query execution plan. To view a plan, you can select one of the following options (their switches are located on the right):

  • Estimated — predicted query execution plan (similar to what EXPLAIN provides without actually running the query).

  • Actual — actual query execution plan (requires the system.processors_profile_log table). When this option is selected, general information about executing a query that read data from a table is displayed at the top of the panel:

    • wall — how much time was spent;

    • cpu — processor operation, query execution parallelism;

    • mem — amount of memory used;

    • outside plan steps — percentage of time spent performing internal ClickHouse work to process the query that is not directly related to reading data.

    In addition, the execution time and number of processed rows are displayed for each step of the query plan.

ADQM Notebook also supports the following two views of the query execution plan:

  • Pipe — query execution pipeline the same as EXPLAIN PIPELINE outputs it.

  • Logical — logical query execution plan presented as a schema that includes only the steps, which relate to obtaining the requested data (reading/filtering/aggregating/sorting data). Uninformative blocks (for internal processes that ClickHouse runs "under the hood" to handle a query) are not shown here. Read the query plan from the bottom up.

If the Actual and Logical options are selected, information about each step of query execution is indicated in the plan as follows:

  • The width of arrows between the blocks corresponds to the number of data rows obtained as a result of the previous step and received as input for the next step.

  • A block corresponding to the longest stage of query execution is highlighted in color.

  • Inside a query plan block or in its tooltip (shown when you hover over the block), you can view information about the number of data rows processed at this stage, the stage execution time, and how much of this time is relative to the total query execution time. A Read block displays the number of data parts and granules read from the table.

  • The line inside a block shows what time was spent on at this stage of the plan — in the tooltip, you can see which processes correspond to the different colors of the line and how long each process took to complete.

Query execution plan
Query execution plan
Query execution plan
Query execution plan

If a query uses an ineffective filter or a sorting key is not defined for a table (this can significantly reduce the query execution speed), the FINDINGS panel is displayed at the bottom, which provides:

  • description of the possible issue (click Show step to highlight the plan step it affects);

  • recommendation on how to work around the issue and improve query performance (click How to fix to view the recommendation).

For example, in the image above, the FINDINGS panel explains: the query filters data by the b column, not by the a column, which is specified first in the table’s (a, b) sorting key; therefore, when reading from the table, all 92 granules are processed (excess data is not skipped), which negatively affects query performance. To speed up the query, it is recommended to either add filtering by the first key column (a) to the query, or (for queries filtering only by the b column) create a projection with the b or (b, a) sorting key. See the Sparse primary index section for detailed information and recommendations on the assignment and use of key columns in ADQM tables.

Possible issues that can be detected and displayed in the FINDINGS panel:

  • Table has no sorting key

  • Filter can’t use the sorting key

  • Filter skips the leading key column

  • Aggregation/Sort spilled to disk

Query execution statistics

If query logging is enabled in ADQM (the query_log parameter is activated), an SQL cell displays the QUERY STATS panel with the following information about the query execution:

  • Duration — query execution time;

  • Read — total number of rows read from all tables and table functions involved in a query;

  • Scanned — total number of bytes read from all tables and table functions involved in a query;

  • Memory — memory used by a query;

  • Threads — peak number of threads used simultaneously during query execution;

  • Node Breakdown — information about query execution on each host (when a query is executed in an ADQM cluster);

  • Details — detailed information including: query kind (SELECT, INSERT, etc.), number of rows written (for write queries), bytes written, number of rows in query results, size of query results in bytes, and names of databases/tables/columns accessed by the query.

QUERY STATS panel
QUERY STATS panel
QUERY STATS panel
QUERY STATS panel

Statistics are displayed automatically after executing a query if the Show Query Statistics option is enabled in the ADQM Notebook interface settings. If this option is disabled (by default), click Show Query Stats in the panel to view statistics.

Fetch query statistics
Fetch query statistics
Fetch query statistics
Fetch query statistics

To select a cluster for receiving query statistics, use the Cluster for Statistics setting. If no clusters are defined in the ADQM configuration, this setting is fixed at Single node.

Settings for query statistics
Settings for query statistics
Settings for query statistics
Settings for query statistics

Multiple statements in a cell

You can enter multiple (up to eight) queries into a single SQL cell, separating them with semicolons. The number of queries in a cell is displayed in the control panel as n statements.

If there are multiple queries in an SQL cell, after they are executed (use the run icon Run button to run, as in the case of a single query in a cell), the results panel will display the corresponding number of tabs — a separate tab for each query with its results (on the Table, Chart and Plan tabs) and execution statistics (QUERY STATS). On the right, the results panel shows the number of executed queries, the total number of read data rows, and the total execution time.

Results of executing multiple queries in an SQL cell
Results of executing multiple queries in an SQL cell
Results of executing multiple queries in an SQL cell
Results of executing multiple queries in an SQL cell

Queries are executed sequentially in the specified order (Stop interrupts the current statement). If you need to change the current database or set parameter values so that they apply to all queries in a cell, place the USE and SET statements before other queries in the list.

Found a mistake? Seleсt text and press Ctrl+Enter to report it