dokumentace k produktu Invantivesoučást invantive cloud
Fóra podpory InvantivePřihlásit se/ Zaregistrujte se

Datový model

This page is partly available in your language; the rest is shown in the original version.

The SQL driver for Invantive Script exposes the execution profile of the script being run: the runs performed, the statements executed, the scripting variables defined and the operating-system commands started on behalf of the script. It allows a script to report on itself, so that the duration and the outcome of each statement can be queried with SQL instead of being read back from a log file afterwards.

Dostupné od verze 26.0. The driver covers 4 tables and 69 columns.

Technické údaje

The SQL driver for Invantive Script does not support partitioning. Úvod do konceptů Invantive UniversalSQL, jako jsou databáze, datové kontejnery a particionování, najdete v Invantive UniversalSQL grammar.

The driver is a service driver, so the connection is always present in a database and occurs at most once. No data container is defined for it in Settings and no log on takes place.

Ovladač má následující vlastnosti:

Scope of the Profile

The profile covers the process in which the statements run. It is held in memory and starts empty each time the product is started, so a query returns the runs and statements of the current process only and never those of an earlier one. A query on the profile is itself a statement and therefore appears in its own results, with the columns describing its outcome still empty because it has not ended yet.

A statement executed on its own, such as the statement under the cursor in Invantive Query Tool, forms a run of one statement with SOURCE_KIND set to INTERACTIVE, so Runs@script holds one row per such execution. Statements executed together as a script share one run.

The profile is filled by the product running the script. It is available in the products which carry Invantive Script, such as Invantive Data Hub and Invantive Query Tool; a product which executes statements without Invantive Script leaves the profile empty. See Invantive Script for the language itself.

Statements which handle a secret are registered without their text. The text of a statement such as a log on which carries a password is replaced by (anonymized) and the column IS_ANONYMIZED reads true; the hash in STATEMENT_HASH is still filled, so identical statements remain comparable without the secret being retained.

Objekty

Pro každou kategorii objektů je k dispozici seznam:

Příklady

The following example lists the statements of the current run from slowest to fastest:

select sen.statement_type
,      sen.sql_operation
,      sen.duration_ms
,      sen.rows_affected
,      substr(sen.statement_text, 1, 60) statement_text
from   StatementExecutions@script sen
where  sen.ended_utc is not null
order
by     sen.duration_ms desc

The following example reports the statements which failed, together with the reason:

select sen.id
,      sen.statement_type
,      sen.error_message_code
,      sen.error_message
from   StatementExecutions@script sen
where  sen.successful = false
order
by     sen.id

The following example totals the time spent per kind of statement:

select sen.statement_type
,      count(*) statements
,      sum(sen.duration_ms) duration_ms
from   StatementExecutions@script sen
group
by     sen.statement_type
order
by     duration_ms desc