> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-refactor-inspector-field-layout.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Results

> Result tabs, pinning, the row cap, and what a failed or non-SELECT statement shows

Every statement you run gets its own result tab. The next run reuses an unpinned one rather than adding to the pile, so a tab survives only as long as you leave it unpinned.

<Frame caption="Result tabs above the grid">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-refactor-inspector-field-layout/dVn-gILXlhQ7lA6L/images/query-results.png?fit=max&auto=format&n=dVn-gILXlhQ7lA6L&q=85&s=0c8bc268a7019f6afcae750b50a745f2" alt="Query result tabs" width="1560" height="960" data-path="images/query-results.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-refactor-inspector-field-layout/dVn-gILXlhQ7lA6L/images/query-results-dark.png?fit=max&auto=format&n=dVn-gILXlhQ7lA6L&q=85&s=3f2c3705b34f838ce3057175a0da8b9d" alt="Query result tabs" width="1560" height="960" data-path="images/query-results-dark.png" />
</Frame>

## Naming

A result is named after the table it came from. When there is no single table, the statement names itself, and a line comment written above the statement wins over the SQL:

```sql theme={null}
-- monthly totals
SELECT count(*) FROM orders;
```

names its result tab `monthly totals`. Names longer than 28 characters are truncated with an ellipsis, and a result no statement stands behind falls back to `Result 1`. Rest the pointer on a tab to see the query that produced it, or the error message if it failed.

## Working with the strip

| Action                 | How                                                                              |
| ---------------------- | -------------------------------------------------------------------------------- |
| Switch result          | `Cmd+Option+[` and `Cmd+Option+]`, or click the tab                              |
| Pin                    | The pin on the right of the tab, `Cmd+Option+P`, or right-click > **Pin Result** |
| Close                  | `Cmd+Shift+W`, or right-click > **Close**                                        |
| Close the rest         | Right-click > **Close Others**                                                   |
| Show or hide the panel | `Cmd+Option+R`, or the toolbar button                                            |

A pinned result moves to the front of the strip, and the next query opens a new tab instead of overwriting it. Pinned tabs cannot be closed or cleared until you unpin them, which is what makes them useful for comparing two runs side by side.

Picking a result moves the editor cursor to the statement that produced it and unfolds that statement if it was collapsed. Picking the result already showing does nothing, so clicking between pinned results never moves the editor under you. A statement you have since edited away leaves the cursor where it is.

The results panel expands itself when a query runs. The toolbar's trash button clears the query and the results together; to keep the query, right-click the results and choose **Clear Results**.

## How long it took

The toolbar's right side reads the elapsed time of the last query, from sending it to having the last row. On a remote server, or through an [SSH tunnel](/connections/ssh-profiles), most of a large result's elapsed time is transfer rather than the query.

Click the number for the split.

| Row       | What it measures                                                              |
| --------- | ----------------------------------------------------------------------------- |
| Elapsed   | Sending the query to having the last row                                      |
| Server    | Execution time the engine reported for itself, with no network in it          |
| First row | Sending the query to the first row arriving, including one network round trip |
| Transfer  | The rest of the elapsed time, spent moving rows                               |

A long **Transfer** behind a quick **Server** or **First row** is a slow link or a wide result, not a slow query.

MySQL, MariaDB, PostgreSQL, CockroachDB, Redshift, ClickHouse and BigQuery report **First row**. BigQuery adds **Server** from its job statistics, and ClickHouse adds it on a query that returns no rows, where the summary arrives as a header the client sees. Every other engine shows the elapsed time on its own, and the number does not open.

## The row cap

A query that returns rows and carries no `LIMIT`, `FETCH FIRST` or `TOP` of its own stops at the row cap: `SELECT`, `WITH`, `TABLE`, `VALUES`, and a set operation whose arms are parenthesised.

Your SQL reaches the server exactly as you wrote it. The cap applies to the rows read back, so a
query carrying its own `LIMIT`, `FETCH FIRST` or `TOP` is never touched, and `EXPLAIN`, `SHOW`,
writes and DDL are never capped. The read itself stops at the cap on MySQL, MariaDB, PostgreSQL,
CockroachDB, Redshift, SQLite, MSSQL, Oracle, Cassandra, Redis, DynamoDB, BigQuery, Snowflake, Trino,
ClickHouse and MongoDB, so the rest of the result never crosses the network. Cloudflare D1, LibSQL,
Etcd, DuckDB, Elasticsearch, Typesense, SurrealDB, Beancount and Dameng still read the whole result and keep the
first rows. A plan that has to finish before it can return a first row, a sort with no index or a
`GROUP BY`, runs to completion on the server either way. Both numbers are in **Settings > Data**
([Data settings](/customization/data-settings)).

When the cap trims a result the status bar reads **Showing N rows** and offers **Fetch All**, which extends the result in place. To skip the cap for one run, press `Cmd+Option+Enter` or choose **Execute Without Limit** from the Execute button's menu.

## Statements that return no rows

INSERT, UPDATE, DELETE and DDL show a success view with the affected row count and the execution time.

A failed statement shows a red banner above the results with the database's own error message and a **Fix with AI** button. See [AI Assistant](/features/ai-assistant).
