Analyzing a Query
The command
queryAnalysis()
expects a valid SQL command. The SQL command runs using the currently open connection (The Default Connection, or the connection you've connected to in REPL Mode), there is no need to explicitly specify its name.
We recommend you go over our actual vs estimated plan explanation here-
By default, the CLI uses the estimated plan.
- Information about each table used by the query.
- The Execution Plan.
- The Metrics calculated from the Execution Plan, DB Schema and Data.
- Insights evaluated from the metrics.
- Web app link for more information.
To analyze queries that do not fit in one line use a variable-
my_query="select * from postgres_air.flight limit 100"
metis-cli query-analysis "$my_query"
CLI
REPL
metis-cli query-analysis "select count (*) from sales.order_lines where quantity > 315"
queryAnalysis("select count (*) from sales.order_lines where quantity > 315")

The result of runing query-analysis
The metrics are calculated from the execution plan, schema and sql command. A metric itself is not good nor bad, only the insights gives context to the metrics, evaluated against the best practices and our knowledge base.

The Insights
Analyze a query, and show the execution plan too
CLI
REPL
metis-cli query-analysis "select count (*) from sales.order_lines where quantity > 315" --show-plan
queryAnalysis("select count (*) from sales.order_lines where quantity > 315").showPlan(true)
Last modified 3mo ago