SET STATISTICS PROFILE

SET STATISTICS PROFILE#

Executes Transact-SQL statements and returns the actual execution plan for each one as a detailed rowset with run-time counters. It reports the same plan as SET STATISTICS XML, rendered as rows rather than an XML document.

Syntax#

SET STATISTICS PROFILE { ON | OFF }  [;]

Remarks#

When ON, statements run normally and, after each statement’s data result set (or sets), its plan is returned as an extra rowset. The rowset is the 18-column SET SHOWPLAN_ALL schema prefixed with two run-time columns, Rows and Executes — 20 columns in total. Data and plan result sets are interleaved per statement. Unlike the estimated modes, this mode does not need to be alone in its batch and works over RPC — parameterized commands (sp_executesql) and prepared statements return their data followed by the plan.

A statement with no query plan (such as a SELECT with no FROM) produces its data only, with no plan rowset — this matches SQL Server.

The plan reflects what Querona actually does: work pushed down to a source appears as a Remote Query operator, while work the engine performs itself appears as ordinary relational operators. See Reading execution plans for how to read these plans.

Counter semantics to be aware of: only the root operator’s Rows value is real (the rows returned to the client); interior operators have a NULL Rows value — their row count is not modeled, never fabricated. Executes is 1 for every operator regardless (each ran exactly once). Querona does not produce parallel plans. Cost figures (EstimateIO, EstimateCPU, TotalSubtreeCost) are always 0 — Querona has no optimizer cost model, so there is nothing to estimate.

When both this mode and SET STATISTICS XML are ON, each statement returns its result sets in the order data, then this PROFILE rowset, then the XML document.

Permissions#

Requires membership in the public role. Unlike SQL Server, Querona does not gate execution-plan output behind a separate SHOWPLAN permission.

Examples#

SET STATISTICS PROFILE ON;
GO
SELECT * FROM crm.dbo.customers WHERE region = 'EU';
GO
SET STATISTICS PROFILE OFF;
GO

See Also#