Skip to content

Query Planning

Explaining query plans

If you have slow queries or unexpected query results, it can be helpful to print the resolved query plan. You can use the explain_plan method to do this:

To understand how a query was actually executed—including metrics like execution time, number of rows processed, I/O stats, and more—use the analyze_plan method. This executes the query and returns a physical execution plan annotated with runtime metrics, making it especially helpful for performance tuning and debugging.