Relix

Programming guide

relix explain

Prints the physical plan of each query: how the engine would run it.

Usage

relix explain [OPTIONS] [SCRIPT...]

Arguments

ArgumentDescription
SCRIPT...Script files, each run in a session of its own; - is standard input. With neither -e nor SCRIPT, standard input is read when it is not a terminal.

Options

OptionDescription
-e, --expr=TEXTRelix text to run. Repeatable: the texts are one script, in order. A bare relational expression runs as a query.
-i, --input=NAME=[FORMAT:]LOCATIONBind the relation NAME to a file, an http(s) URL (with --remote), or - for standard input. FORMAT is csv, tsv, json or ndjson; without it the extension decides, and standard input must name one. Repeatable.
--schema=NAME={...}The heading of the input NAME, such as NAME='{ id: NUMBER, name: STRING }', instead of inferring one.
--infer-rows=NInfer an input's heading from its first N records (default: 1000).
--unbounded=NAMEThe input NAME never ends, as tail -f's does: its rows stream as they arrive, and a query that would have to read all of it first is refused. Repeatable.
--jsonWrite one JSON object per query, {"script", "query", "plan"}, one per line.
--query=NAMEExplain only the query NAME.

It also takes the global options.

Examples

shell
relix explain -e 'GROUP city, COUNT(*) -> n (Customers JOIN Orders)'
Result
Aggregate
└─ Join NATURAL/HASH build=RIGHT
   ├─ Scan Customers
   └─ Scan Orders

--json writes each query's plan as a JSON object instead:

shell
relix explain --json -e 'SELECT amount > 100 (Orders)' | jq -c 'keys'
Result
["plan","query","script"]