# 22. Virtuoso Functions Guide - explain

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
cov_load
cov_report
cov_store
dbg_obj_print
dbg_printf
explain
pldbg_stats
pldbg_stats_load
trace_off
trace_on
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## explain

describe SQL statement compilation
explain (in textvarchar, [in cursor_type integer]);
Parameters
text – varchar SQL statement
cursor_type – integer cursor type
Return Values

explain returns a result set of single varchar column rows.

Description

The explain function compiles a SQL statement and returns a description of the compilation as a result set. The set consists of one column, a varchar, which corresponds to each line of the description but may be long, several hundred characters.

The output is not a complete disassembly of the query graph but is detailed enough to show the join order, subquery structure and the order of evaluation of predicates as well as the splitting of a distributed VDB query over different data sources.

The optional cursor type can be one of the SQL_CURSOR_<xx> constants. The default is 0, for forward only. If the statement is a SELECT and the cursor type is not forward only, the auxiliary SQL statements used by the cursor implementation are shown.

Specifying a cursor type of -5 produces a diagnostic dump to the server's standard output. This contains the costs associated with different join orders tried during the compilation.

See Also