misc/mzexplore/README.md
bin/mzexplore can extract plans from environments running
Materialize. By running:
mzexplore extract plans ... \
--explainee-type catalog_item \
--with arity --with humanized_exprs --with join_impls \
--format json \
--stage optimized_plan
you can extract JSON files corresponding to the optimized MIR plan of a catalog item.
This directory contains jq scripts for extracting information from
these JSON outputs.
filters.jq: finds all predicates used in filters and returns a
list, sorted by number of occurrences descending
leftjoins.jq: finds unreduced left joins (particularly shaped
unions of antijoins and an inner join)
defs.jq: utility functions
Note that the ASTs we produce in JSON are quite deeply nested, so you
can't use stock jq. As of 2024-03-12, there is a PR open to
jq to allow you to specify
unbounded depth on the command-line, i.e., --depth 0.
If you have multiple JSON files you'd like to analyze together, you can run:
find ~/mz-support/tmpfs/ -name \*.json |
xargs jq --slurp --depth 0 -f filters.jq