mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 14:43:03 +01:00
1.5 KiB
1.5 KiB
RDB$SQL package (FB 6.0)
RDB$SQL
is a package with utility routines to work with dynamic SQL.
Procedure EXPLAIN
RDB$SQL.EXPLAIN
returns tabular information of a query's plan, without execute the query.
Since SQL
text generally is multi-line string and have quotes, you may use <alternate string literal>
(strings prefixed by Q
) as a way to make escape easy.
Input parameters:
SQL
typeBLOB SUB_TYPE TEXT CHARACTER SET UTF8 NOT NULL
- query statement
Output parameters:
PLAN_LINE
typeINTEGER NOT NULL
- plan's line orderRECORD_SOURCE_ID
typeBIGINT NOT NULL
- record source idPARENT_RECORD_SOURCE_ID
typeBIGINT
- parent record source idLEVEL
typeINTEGER NOT NULL
- indentation level (may have gaps in relation to parent's level)PACKAGE_NAME
typeRDB$PACKAGE_NAME
- package name of a stored procedureOBJECT_NAME
typeRDB$RELATION_NAME
- object (table, procedure) nameALIAS
typeRDB$SHORT_DESCRIPTION
- alias nameRECORD_LENGTH
typeINTEGER
- record length for the record sourceKEY_LENGTH
typeINTEGER
- key length for the record sourceACCESS_PATH
typeRDB$DESCRIPTION NOT NULL
- friendly plan description
select *
from rdb$sql.explain('select * from employee where emp_no = ?');
select *
from rdb$sql.explain(q'{
select *
from (
select full_name name from employee
union all
select customer name from customer
)
where name = ?
}');
Authors
- Adriano dos Santos Fernandes