---
title: "Inspect a statement | Speedscale Docs"
description: "Open a recorded PostgreSQL, MySQL or SQL Server call in proxymock web to see the statement with its bound values, who ran it, how it ended or why it failed, the request that caused it, and every other call on the same database connection."
canonical: "https://docs.speedscale.com/proxymock/databases/inspect-a-statement/"
---

[Documentation index](https://docs.speedscale.com/proxymock/llms.txt) | [Markdown](https://docs.speedscale.com/proxymock/databases/inspect-a-statement/index.md) | [Canonical page](https://docs.speedscale.com/proxymock/databases/inspect-a-statement/)

# Inspect a statement

Every database call proxymock records opens in a detail view that answers the questions you would otherwise ask the database: what exactly ran, with which values, for whom, how it ended, and what else that connection was doing. Select any Postgres, MySQL or SQL Server call in the Requests grid or the [Live SQL](https://docs.speedscale.com/proxymock/databases/watch-live-sql/) lens to open it.

<a id="info-who-ran-it-and-where-it-came-from"></a>

## Info: who ran it and where it came from

The **Database** section at the top of the Info tab gathers what proxymock knows about the call:

*   **caused by** names the inbound request that ran it, marked **by trace id** when the app wrote that request's trace id into the statement's SQL comment and **by time** when proxymock inferred it from timing. Select it to open that request. See [Link queries to the request that ran them](https://docs.speedscale.com/proxymock/databases/link-queries-to-requests/).
*   **user**, **database** and **session** say who ran it on which connection. **Connection** opens the Connection tab.
*   **transaction** says whether the statement ran inside a transaction, and whether that transaction had already failed.
*   **event**, **operation**, **table**, **rows** and **statement** describe the call. The statement is its shape, with values masked, so it is the same for every execution of one statement.
*   **route** and **trace** come from the SQL comment, when the app writes one.

Each fact has a filter and an exclude button, which add it to the Requests filters.

![The Database section of a call's Info tab: caused by POST /orders, my-app, by trace id; user demo, database shop, session 75 with a Connection link, transaction active, event statement, operation INSERT, table order\_items, rows 1, the statement shape, route /orders and the trace id, each with filter and exclude buttons](https://docs.speedscale.com/assets/images/database-facts-2962e643842da29daf2a17f7d3af9c4f.png)

<a id="request-the-sql-with-its-values"></a>

## Request: the SQL with its values

The **Statement** view of the Request tab shows the SQL the call ran. A prepared statement arrives with placeholders and its values separately, so proxymock shows both:

*   **SQL** shows the statement as the app sent it, with `$1`, `?` or `@p1` placeholders.
*   **With values** fills the bound values in as literals, so you can copy the statement into `psql`, `mysql` or `sqlcmd` and run it. SQL Server values are written as T-SQL, such as `N'text'` for a string and `0x0A1B` for binary.
*   **Parameters** lists each placeholder with its type and value.

A value proxymock could not decode, or a statement that was prepared before recording started, is marked as such rather than guessed.

![The Request tab's Statement view with With values selected: INSERT INTO order\_items (order\_id, product\_id, quantity, price) VALUES (2, 2, 1, 59) with its SQL comment, and a Parameters table listing $1 int4 2, $2 int4 2, $3 int4 1 and $4 numeric 59](https://docs.speedscale.com/assets/images/statement-values-e3c1c117be0908846ede3d7a69de0014.png)

<a id="sql-server-calls"></a>

## SQL Server calls

A SQL Server call is one SQL batch, one RPC or one transaction request:

*   A batch shows its full T-SQL text, which can hold several statements and return several result sets.
*   An `sp_executesql` or `sp_prepexec` call shows the SQL it carries with its typed parameters. An `sp_execute` call shows the SQL its handle was prepared with.
*   A stored procedure called by name shows the procedure and its parameters, and its response shows the rows, the return value and the return status.
*   Informational messages, such as `PRINT` output and `RAISERROR` at severity 10 or below, appear with the response.
*   `BEGIN`, `COMMIT` and `ROLLBACK`, whether sent as T-SQL or as the driver's transaction requests, mark the transaction on the Connection tab.

<a id="response-how-it-ended"></a>

## Response: how it ended

The top of the Response tab says how the call ended:

*   A successful call shows what it did, such as `INSERT 0 1` or the rows it returned. Writes return no rows, so this is where an `UPDATE` or `DELETE` says how many rows it changed.
*   A failed call shows an error card with the message, the SQLSTATE or the MySQL or SQL Server error number and its name, the objects the server named, and the line of SQL the server pointed at with a caret under the position.
*   A call that was cancelled, timed out, deadlocked, waited too long for a lock or was terminated shows why, and lists what other sessions were running at the same time, which is usually where the cause is.
*   A login shows who connected to which database, the client application, the authentication method and the server version. For a SQL Server connection recorded without TLS interception whose driver encrypted the login packet, the user and application are not known; see [Record SQL Server](https://docs.speedscale.com/proxymock/databases/record/sqlserver/#encryption).

The **Result sets** view shows each table the query returned as a grid.

<a id="connection-everything-that-connection-did"></a>

## Connection: everything that connection did

The **Connection** tab lists every call on the same database connection in order, from the login to the logout, with the selected one highlighted. Calls inside a transaction are grouped with a colored bar and a number, and a chip above the list says how each transaction ended (committed, rolled back, failed, ended or still open), how long it took and how long the client held it open without running anything.

Use it to see what led up to a failed or slow statement, whether a transaction held locks while the app did something else, and in what order a request's statements really ran. **Export as .sql** downloads the connection's statements as a script; see [Export a SQL script](https://docs.speedscale.com/proxymock/databases/export-sql-script/).

![The Connection tab: 45 requests on this connection, a chip reading #1 committed, 7.243 ms, 0.579 ms idle, Export as .sql, and the connection's calls in order from the login through selects, a transaction marked #1 in green from BEGIN through inserts and updates to COMMIT with the selected INSERT highlighted, and a pg\_sleep call after it](https://docs.speedscale.com/assets/images/connection-b7ccbcda873bb0bbbe7f4b6b1fe761f0.png)

<a id="related"></a>

## Related

*   [Watch live SQL](https://docs.speedscale.com/proxymock/databases/watch-live-sql/)
*   [Database traffic](https://docs.speedscale.com/concepts/database-traffic/)
*   [Inspect a statement in the Speedscale dashboard](https://docs.speedscale.com/guides/databases/inspect-a-statement/)
